Hi Jeramy, Thanks for all the information. We are using default mysql timeout value. We will increase mysql timeout value and check. We are already using a validation query. Problem is only the first request does not work properly. After that everything works without any issues.
Regards, Chathuri On Fri, Jun 7, 2013 at 4:53 PM, Jeremy Bauer <[email protected]> wrote: > 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. > > > http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_wait_timeout > > 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 ( > http://commons.apache.org/proper/commons-dbcp/configuration.html) 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 ( > > http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html > ) > and the socket timeout is 0 (no timeout) - so I wouldn't guess that the > driver is causing the time out. > > hth, > -Jeremy > > > On Fri, Jun 7, 2013 at 3:02 PM, Chathuri Wimalasena <[email protected] > >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] http://airavata.apache.org/ > > [2] > > > > > https://svn.apache.org/repos/asf/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml > > [3] > > > > > https://svn.apache.org/repos/asf/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java > > >
