openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Bauer <>
Subject Re: Connection lost issue after several hours of idle time
Date Fri, 07 Jun 2013 20:53:01 GMT
Hi Chathuri,

Do you know how many hours it takes before connections are dropped?  Based
on your persistence.xml, it looks like you are using MySQL.  By default
MySQL connections will timeout after 8 hours of inactivity.  MySQL provides
a parameter "wait_timeout" that can be used to set the amount of time to
allow a non-interactive connection to site idle before closing it.

On the client, DBCP includes additional parameters that you can use to tune
the timeout and purge behavior of the connection pool.  A combination of
validationQuery, testWhileIdle, etc. may help clear idle connections that
have gone stale out of the pool ( before
they get handed to OpenJPA.  I also checked on the MySQL driver and based
on the documentation, TCP keep alive should be enabled by default (
and the socket timeout is 0 (no timeout) - so I wouldn't guess that the
driver is causing the time out.


On Fri, Jun 7, 2013 at 3:02 PM, Chathuri Wimalasena <>wrote:

> Hi Devs,
> In apache airavata project[1], we are using apache openJPA as the layer in
> front of our database. We have clients which run scientific jobs using
> apache airavata project and these jobs can be idle for several hours. In
> our openJPA configuration we are maintaining a connection pool. But it
> seems connection gets lost after several hours of idle time. Is there any
> property that we can maintain from openJPA configuration to make sure
> connection will not be lost after several hours of idle time ?
> FYI, I'm listing the openJPA configuration [2] and how the properties[3]
> ingested from a java class.
> Thanks and Regards,
> Chathuri
> [1]
> [2]
> [3]

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message