Bug 462312 - postgresql-odbc (psqlODBC) protocol error with IPv6
postgresql-odbc (psqlODBC) protocol error with IPv6
Product: Fedora
Classification: Fedora
Component: postgresql-odbc (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tom Lane
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-09-15 06:34 EDT by Zoltan Boszormenyi
Modified: 2013-07-02 23:20 EDT (History)
1 user (show)

See Also:
Fixed In Version: 08.03.0200
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-10-20 18:11:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description Zoltan Boszormenyi 2008-09-15 06:34:32 EDT
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:

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
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

How reproducible:


Steps to Reproduce:
1. Setup an ODBC DSN using IPv6 server address.
2. Try to connect via isql or some other ODBC app.
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 13:14:11 EDT
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 13:48:29 EDT
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
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 14:53:44 EDT
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 08:02:53 EDT
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 09:20:29 EDT
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 09:37:07 EDT
postgresql-odbc-08.03.0200-1.fc9 has been submitted as an update for Fedora 9.
Comment 7 Fedora Update System 2008-09-24 20:10:29 EDT
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 18:11:05 EDT
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.