DataSource suddenly drops all connections? - Mailing list pgsql-jdbc

From Holger Klawitter
Subject DataSource suddenly drops all connections?
Date
Msg-id 200302181402.41024.lists@klawitter.de
Whole thread Raw
Responses Re: DataSource suddenly drops all connections?
List pgsql-jdbc
Hi there,

I've run into a strange problem with Tomcat (4.1.12; JDK 1.4.1_01; Linux
2.4.19). My webappliaction connects to a postgres database (7.3) via
javax.sql.DataSource (I am using the jdbc driver coming with 7.3).

From time to time out of the blue the DataSource seems to deliver broken
connections.

java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
        at
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:69
)
        at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:127)
        at org.postgresql.PG_Stream.flush(PG_Stream.java:352)
        at org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:154)
        at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:70)
        at
org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Con
nection.java:505)
        at
org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Stat
ement.java:320)
        at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Stat
ement.java:48)
        at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc
1Statement.java:153)
        at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc
1Statement.java:141)
        at
org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingSt
atement.java:162)
    at ....

Sometimes I find an error in the catalina and in the postgres log indicating
that *one* statement got garbled (SQL syntax error). It looks like this:

ERROR:  parser: unterminated quoted string at or near "'Ort: xxxxxxxxxxxx" at
character 52
FATAL:  Socket command type ' unknown

From then on, nothing reaches postgres any more.

I am quite confident that the servlet itself is thread safe, and the statement
being sent is (afaict) correct (everything nicely escaped and such). Moreover
such an error should not break all connections in the pool, should it?

Has anyone observed similar behaviour? What can I do to narrow down the bug
in order to blame the right one? :-)

With kind regards / mit freundlichem Gruß
    Holger Klawitter
--
Holger Klawitter                          http://www.klawitter.de
lists@klawitter.de

pgsql-jdbc by date:

Previous
From: Daniel Serodio
Date:
Subject: Re: Database Instance Creation via Java/JDBC
Next
From: Barry Lind
Date:
Subject: Re: DataSource suddenly drops all connections?