users@glassfish.java.net

Re: DB connection retry

From: Jagadish Prasath Ramu <Jagadish.Ramu_at_Sun.COM>
Date: Sat, 23 Feb 2008 14:33:38 +0530

"validate-atmost-once-period-in-seconds" attribute of connection pool
will help to reduce the no. of validation calls.

Thanks,
-Jagadish


On Sat, 2008-02-23 at 07:58 +0530, Jagadish Prasath Ramu wrote:
> This issue will be because, same connection is somehow used to start a
> transaction (eg: setting autocommit to false) and returned to pool
> without doing a commit/rollback, setting autocommit back to true. Please
> check your application.
>
> Thanks,
> -Jagadish
>
>
> On Fri, 2008-02-22 at 14:35 -0500, Mei Wu wrote:
> > In our application, we have a DB connection retry logic, i.e. whenever a
> > SQLException happens, we test the connection is valid or not, if not,
> > the connection is closed and then for every a few seconds, a new
> > connection is obtained from pool by :DataSource.getConnection() and
> > until a valid connection is obtained.
> > This is done without setting validation on for the Connection Pool to
> > avoid overhead. However, if the data source is XADataSource,
> > DataSource.getConnection() itself will have exception like below:
> >
> > [#|2008-02-22T11:50:41.580-0500|WARNING|sun-appserver9.1|javax.enterprise.system.core.transaction|_ThreadID=23;_ThreadName=BPELSEInOutThread5;_RequestID=c72ac31a-d53a-403a-8605-fcb92ccf3314;|JTS5041:
> > The resource manager is doing work outside a global transaction
> > oracle.jdbc.xa.OracleXAException
> > at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1045)
> > at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:249)
> > at com.sun.gjc.spi.XAResourceImpl.start(XAResourceImpl.java:222)
> > at
> > com.sun.jts.jta.TransactionState.startAssociation(TransactionState.java:305)
> >
> > at com.sun.jts.jta.TransactionImpl.enlistResource(TransactionImpl.java:205)
> > at
> > com.sun.enterprise.distributedtx.J2EETransaction.enlistResource(J2EETransaction.java:562)
> >
> > at
> > com.sun.enterprise.distributedtx.J2EETransactionManagerImpl.enlistResource(J2EETransactionManagerImpl.java:372)
> >
> > at
> > com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.enlistResource(J2EETransactionManagerOpt.java:144)
> >
> > at
> > com.sun.enterprise.resource.SystemResourceManagerImpl.enlistResource(SystemResourceManagerImpl.java:98)
> >
> > at
> > com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:216)
> >
> > at
> > com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:337)
> >
> > at
> > com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:189)
> >
> > at
> > com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165)
> >
> > at
> > com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:158)
> >
> > at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:108)
> > at
> > com.sun.jbi.engine.bpel.core.bpel.connection.DBConnectionFactory.createXAConnection(DBConnectionFactory.java:259)
> >
> >
> > And it seems whenever that happens and if a retry is triggered, memory
> > usage surges instantly causing other more severe problems. Is the memory
> > issue expected, do we have the another option other than enabling
> > validation on Connection Pool ?
> >
> > Thanks
> > Mei
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> > For additional commands, e-mail: users-help_at_glassfish.dev.java.net
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>