users@glassfish.java.net

[gf-users] _at_Schedule job being killed

From: Will Hartung <willh_at_mirthcorp.com>
Date: Fri, 12 Jun 2015 13:35:33 -0700

GF 3.1.2.2

We have a @Schedule annotated job that runs regularly, every 15s or so.

Occsionally, we get this exception:

[#|2015-06-12T12:30:05.015-0700|SEVERE|glassfish3.1.2|javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource|_ThreadID=569;_ThreadName=Thread-2;|RAR5031:System
Exception
javax.resource.spi.LocalTransactionException: This connection has been closed.
        at com.sun.gjc.spi.LocalTransactionImpl.commit(LocalTransactionImpl.java:112)
        at com.sun.enterprise.resource.ConnectorXAResource.commit(ConnectorXAResource.java:124)
        at com.sun.enterprise.transaction.JavaEETransactionImpl.commit(JavaEETransactionImpl.java:501)
        at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.commit(JavaEETransactionManagerSimplified.java:855)
        at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5136)
        at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4901)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2045)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1994)
        at com.sun.ejb.containers.BaseContainer.callEJBTimeout(BaseContainer.java:4088)
        at com.sun.ejb.containers.EJBTimerService.deliverTimeout(EJBTimerService.java:1832)
        at com.sun.ejb.containers.EJBTimerService.access$100(EJBTimerService.java:108)
        at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.run(EJBTimerService.java:2646)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.postgresql.util.PSQLException: This connection has been closed.
        at org.postgresql.jdbc2.AbstractJdbc2Connection.checkClosed(AbstractJdbc2Connection.java:822)
        at org.postgresql.jdbc2.AbstractJdbc2Connection.commit(AbstractJdbc2Connection.java:810)
        at com.sun.gjc.spi.LocalTransactionImpl.commit(LocalTransactionImpl.java:106)
        ... 16 more
|#]

Once we get this, the job is dead and will never run again until we
restart the server or redeploy the application.

Our EJBTimer pool is the standard, Glassfish default running against
Derby, so I'm puzzled why Postgres (which is our normal DB) is
involved in this at all.

I briefly considered that maybe the EJB Timer DB connections are
enlisted in to an XA transaction with the standard EJB transaction.
But that makes no sense. First, our PG Driver is not configured for
XA, second, why would the transaction that manages the EJBTimer be at
all dependent on the status of the logic transaction that the timer is
running.

It also makes no sense that it's dealing with a closed PG connection.

Any insight in to how this is happening is welcome frustrating to have
to restart the server for this. More frustrating was that we had to
add monitoring code to your application to ensure that this job was
continually running and had not stopped.

Thanks!

Regards,

Will Hartung
(willh_at_mirthcorp.com)

-- 
This message, and any documents attached hereto, may contain confidential 
or proprietary information intended only for the use of the addressee(s) 
named above or may contain information that is legally  privileged. If you 
are not the intended addressee, or the person responsible for delivering it 
to the intended addressee, you are hereby notified that reading, 
disseminating, distributing or copying this message is strictly prohibited. 
If you have received this message by mistake, please immediately notify us 
by replying to the message and delete the original message and any copies 
immediately thereafter.  Thank you for your cooperation.