Bug 462312 - postgresql-odbc (psqlODBC) protocol error with IPv6
Summary: postgresql-odbc (psqlODBC) protocol error with IPv6
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: postgresql-odbc
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tom Lane
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-09-15 10:34 UTC by Zoltan Boszormenyi
Modified: 2013-07-03 03:20 UTC (History)
1 user (show)

Fixed In Version: 08.03.0200
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-10-20 22:11:08 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Socket fix from 08.03.0200 (494 bytes, patch)
2008-09-16 12:02 UTC, Zoltan Boszormenyi
no flags Details | Diff

Description Zoltan Boszormenyi 2008-09-15 10:34:32 UTC
Description of problem:

psqlODBC as shipped in Fedora 9 cannot reliably connect to
PostgreSQL via an IPv6 socket. These are the relevant odbcinst.ini
and odbc.ini sections:

------------------------
[psqlODBC]
Description		= Official PostgreSQL ODBC driver
Driver		= /usr/lib64/psqlodbc.so
Driver64	= /usr/lib64/psqlodbc.so
Setup		= /usr/lib/libodbcpsqlS.so
Setup64		= /usr/lib64/libodbcpsqlS.so
UsageCount		= 
CPTimeout		= 
CPReuse			= 
FileUsage		= 1
------------------------
[Jelen2]
Description		= Jelen2
Driver		= psqlODBC
Trace		= No
TraceFile		= 
Database		= jelen2
Servername		= ::1
Username		= 
Password		= 
Port		= 5432
Protocol		= 7.4
ReadOnly		= No
RowVersioning		= No
ShowSystemTables		= No
ShowOidColumn		= No
FakeOidIndex		= No
ConnSettings		= 
------------------------

"isql Jelen2 username password" either cannot connect to the server
or the first SELECT makes the connection drop. The PostgreSQL log says:

LOG:  unexpected EOF on client connection

Version-Release number of selected component (if applicable):

$ rpm -q postgresql-odbc
postgresql-odbc-08.03.0100-1.fc9.x86_64

How reproducible:

Always

Steps to Reproduce:
1. Setup an ODBC DSN using IPv6 server address.
2. Try to connect via isql or some other ODBC app.
3.
  
Actual results:

1 out of approx 4 connections succeeds. But the first stmt makes
the app disconnect with some protocol error, in each case
"unexpected EOF on client connection" appears in the PostgreSQL log.

Expected results:

As psqlODBC uses libpq, it should be able to connect just fine.

Additional info:

Recompiling psqlodbc-08.03.0100 manually doesn't make the problem go away.
However, 08.03.0200 or the CVS version (currently 08.03.0201) fixes it.

Comment 1 Tom Lane 2008-09-15 17:14:11 UTC
Hmm ... updating to .0200 would be an easy answer, but how sure are you that that really fixes it?  I took a quick look at the diffs from .0100 to .0200 and didn't see anything that looked like it would explain this.

Comment 2 Zoltan Boszormenyi 2008-09-15 17:48:29 UTC
Problem is I cannot be sure. However, from empirical data (about 20
connection), only 3 or 4 was successful to the point where "isql"
gave me a prompt instead of a connection error. And soon as I issued
a SELECT, I got an error. Now "isql -vvvv" (using 08.03.0100) says:

[28000][unixODBC]Communication error during authentication;
Error while reading from the socket.
[ISQL]ERROR: Could not SQLConnect

I just retried it, 20 times out of 20 tries it gave me this error.
With 08.03.0200, 20 times out of 20 tries it was successful.
But your comment made me read the diff between 0100 and 0200.
I found this in docs/release.html:

=========================
psqlODBC 08.03.0200 Release
Changes:
1.) Fix a bug in socket which uses a socket variable.
...
=========================

Isn't it pointing to a socket using bug (however vaguely)?
Another datapoint: there's the infamous gcc 4.3.0 bug which made
the update to Wine 1.0 in F9 delayed substantially, the bugfix
was to use CFLAGS="-fno-tree-fre -fno-tree-pre". Just to be sure
that it's not a compiler bug, I recompiled 08.03.0100 with these
extra CFLAGS settings and the problem didn't go away.

Comment 3 Tom Lane 2008-09-15 18:53:44 UTC
Yeah, I saw the changelog entry and went ah-hah ... but I can't find any changes in the source code that look like they could be IPv6-related.  So the whole thing seems to need closer investigation.

Comment 4 Zoltan Boszormenyi 2008-09-16 12:02:53 UTC
Created attachment 316838 [details]
Socket fix from 08.03.0200

This single fix from 08.03.0200 made .0100 work reliably over IPv6.

Comment 5 Tom Lane 2008-09-16 13:20:29 UTC
Bizarre ... it's certainly broken, but it should be just as broken for IPv4.  Anyway, I'll bump to .0200 as the best way of resolving this.

Comment 6 Fedora Update System 2008-09-16 13:37:07 UTC
postgresql-odbc-08.03.0200-1.fc9 has been submitted as an update for Fedora 9.
http://admin.fedoraproject.org/updates/postgresql-odbc-08.03.0200-1.fc9

Comment 7 Fedora Update System 2008-09-25 00:10:29 UTC
postgresql-odbc-08.03.0200-1.fc9 has been pushed to the Fedora 9 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update postgresql-odbc'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F9/FEDORA-2008-8239

Comment 8 Fedora Update System 2008-10-20 22:11:05 UTC
postgresql-odbc-08.03.0200-1.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.