Hi,
we have some trouble with a few cronjobs running inside a tomcat webapp.
The problem is exactly described here by David Hustace
<david(at)opennms(dot)org>:
but wasn't solved, it was just recognized as "weired".
http://archives.postgresql.org/pgsql-jdbc/2006-01/msg00115.php
In short: we are running some jobs nightly and sometimes on of those
threads just hangs forever at
at java.net.SocketInputStream.socketRead0(Native Method)
I happens every week or so.
We are running PostgreSQL 9.0.4 on the server side.
At the moment the thread starts hanging we see some
unexpected EOF on client connection
But i don't know if these EOF messages really relate to it.
On the client side we run
postgresql JDBC 9.0-801.jdbc3
c3p0 Version 0.9.1.2
with
c3p0.minPoolSize = 10
c3p0.maxPoolSize = 110
c3p0.checkoutTimeout = 5000
c3p0.maxConnectionAge = 86400
c3p0.maxStatementsPerConnection = 500
c3p0.acquireIncrement = 10
on a hibernate/spring stack
It seems like the client is waiting for postgresql sending data, but
postgresql had already closed the connection due to whatever reason and
the client didn't recognize it.
I can't see any running transaction in my DB corresponding to the
waiting thread.
My options are as far as i know:
- check stale connections in c3p0 before checkout
- set a statement timeout on postgresql server
- set a socket timeout with my jdbc driver
- using a different connection pool like bonecp
But at the moment i can't figure out why strange things like this happen
at all. Is it just a network error and i need a socket timeout? Or is it
a bug inside postgresql server (doubt that!)? Or is my connection pool
or my app buggy? Is it possible that a router between tomcat and DB
server is dropping the connection? I have no clue.
Does anybody know how to fix my problem?
regards
Janning