Strange JDBC problem - Mailing list pgsql-jdbc

From Trygve Hardersen
Subject Strange JDBC problem
Date
Msg-id DC8018C26783D14DBE37F122C8385FC4210E58@POST.firstmover.no
Whole thread Raw
Responses Re: Strange JDBC problem
Re: Strange JDBC problem
List pgsql-jdbc
Hi
I'm experiencing a strange problem with the PostgreSQL JDBC driver on a
project I'm working on. Our setup is like this:

JRE 1.5
Apache Tomcat 5.5.17
Hibernate 3.1
C3P0 0.9.0
PostgreSQL 8.1-407.jdbc3
PostgreSQL 8.1.4

We exclusively use the JDBC connections through Hibernate, which again
uses the C3P0 connection pool. Normally this setup works fine, but on
Win2K SP4, we are experiencing strange problems.

Randomly we get "java.net.SocketException: Connection reset". The error
occurs in different parts of the application, but more frequently some
places, and mysteriously much more frequent when using Internet Explorer
6 (IE) on the same host as the web and DB server (localhost) than when
using Firefox (FF). In fact to begin with we thought the error only
occurred with IE, but we've also seen it happen with FF and Opera
sometimes, but very rarely.

There is nothing in our architecture that links the browser to the JDBC
connection, so I cannot explain why the error almost exclusively occurs
with IE. Even more strangely in not able to reproduce the error when
debugging the JDBC driver (by setting loglevel=2 on the connection URL),
nor when running against a DB on a different server, or when running
Tomcat on a different server using the DB on the affected server. The
application also supports MySQL and we're not seeing this error there.
We've also not seen the error Windows XP.

Here is the stack trace from the "Connection reset" exception. For the
sake of readability I removed some parts which I think is of no
significance:

01-09-2006 07:50:02,071  WARN JDBCExceptionReporter: SQL Error: 0,
SQLState: 08006
01-09-2006 07:50:02,071 ERROR JDBCExceptionReporter: An I/O error
occured while sending to the backend.
01-09-2006 07:50:02,081 ERROR [jsp]: Servlet.service() for servlet jsp
threw exception
org.hibernate.exception.JDBCConnectionException: could not initialize a
collection: [mypackage.pojo.modules.department.Department.children#827]

... Removed

Caused by: org.postgresql.util.PSQLException: An I/O error occured while
sending to the backend.
        at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:
214)
        at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Stateme
nt.java:452)
        at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdb
c2Statement.java:354)
        at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2St
atement.java:258)
        at
com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxy
PreparedStatement.java:76)
        at
org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139
)
        at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
        at org.hibernate.loader.Loader.doQuery(Loader.java:662)
        at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loade
r.java:224)
        at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
        ... 89 more
Caused by: java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:168)
        at
java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
        at
java.io.BufferedInputStream.read(BufferedInputStream.java:235)
        at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:256)
        at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImp
l.java:1163)
        at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:
188)
        ... 98 more

Does this make sense to any of you? It doesn't to me, but the error is
consistent, and I've tested this a lot. Any help or suggestions are much
appreciated.

Regards

Trygve Hardersen
Senior Software Engineer
Scala Nordic

pgsql-jdbc by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] [PATCHES] log_statement output for protocol
Next
From: Guillaume Cottenceau
Date:
Subject: Re: Strange JDBC problem