I've been wrestling with this problem for a little while.
Environment: JBoss 3.2.3, Sun JDK 1.4.2_01 on linux (debian)
I have a stateful bean which appears to work fine for the most part.
I can generally do some operations on it, within a transaction, and then remove the bean. I've set the passivation time very low (20 secs) as well as the expiry times on the bean as below:
<remover-period>10</remover-period> <overager-period>10</overager-period> <max-bean-life>60</max-bean-life> <max-bean-age>20</max-bean-age>
I've found one case however, where this can cause a problem. If I get a handle from the stateful bean, in order to use it ( possibly to put in an HTTPSession, or someother) that works fine.
Restoring the bean (and possibly activating it) from the container also works fine. HOWEVER, I have found that if the remote stub does that, OUTSIDE of a transaction context, there is a ref lock left on the stateful session bean, and from there it won't passivate properly - is this proper behaviour?? (BTW, I haven't yet tried this within a UserTransaction).
Lots of warning like this:
15:20:32,559 WARN [AbstractInstanceCache] Unable to passivate due to ctx lock, id=dpsp9lca-7
15:20:52,597 WARN [AbstractInstanceCache] Unable to passivate due to ctx lock, id=dpsp9lca-7
15:21:12,639 WARN [AbstractInstanceCache] Unable to passivate due to ctx lock, id=dpsp9lca-7
There's some more detail in the snippet of log attached.
-- -- Russell Chan, Navaho Networks Inc. 416 542 1590 x108
2004-01-23 15:20:06,567 DEBUG [org.jboss.ejb.plugins.LogInterceptor] InvokeHome: getEJBObject(dpsp9lca-7) 2004-01-23 15:20:06,567 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Current transaction in MI is null 2004-01-23 15:20:06,567 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TX_REQUIRED for getEJBObject 2004-01-23 15:20:06,567 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Thread came in with tx null 2004-01-23 15:20:06,567 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Starting new tx TransactionImpl:XidImpl [FormatId=257, GlobalId=blade//41, BranchQual=] 2004-01-23 15:20:06,567 TRACE [org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor] HOMEMETHOD coming in 2004-01-23 15:20:06,567 TRACE [org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor] public abstract javax.ejb.EJBObject javax.ejb.Handle.getEJBObject() throws java.rmi.RemoteException 2004-01-23 15:20:06,567 TRACE [org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor] HOMEMETHOD coming in hashcode1665852439 2004-01-23 15:20:06,568 TRACE [org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor] HOMEMETHOD coming in classloader12546448 2004-01-23 15:20:06,568 TRACE [org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor] CONTAINS true 2004-01-23 15:20:06,568 TRACE [org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor] HOMEMETHOD m public javax.ejb.EJBObject org.jboss.ejb.StatefulSessionContainer.getEJBObject(org.jboss.invocation.Invocation) throws java.rmi.RemoteException 2004-01-23 15:20:06,568 TRACE [org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor] public abstract test.TestSFSB test.TestSFSBHome.create(java.lang.Integer) throws javax.ejb.CreateException,java.rmi.RemoteException 2004-01-23 15:20:06,568 TRACE [org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor] -1419501933 2004-01-23 15:20:06,568 TRACE [org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor] 4521906 2004-01-23 15:20:06,568 TRACE [org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor] equals false false 2004-01-23 15:20:06,568 TRACE [org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor] public abstract test.TestSFSBLocal test.TestSFSBLocalHome.create(java.lang.Integer) throws javax.ejb.CreateException 2004-01-23 15:20:06,568 TRACE [org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor] 625404838 2004-01-23 15:20:06,568 TRACE [org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor] 4521906 2004-01-23 15:20:06,568 TRACE [org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor] equals false false 2004-01-23 15:20:06,568 TRACE [org.jboss.ejb.BeanLockManager] Created lock: [EMAIL PROTECTED], bean=TestSFSB, id=dpsp9lca-7, refs=0, tx=null, synched=null, timeout=5000, queue=[] 2004-01-23 15:20:06,568 TRACE [org.jboss.ejb.BeanLockManager] Added ref to lock: [EMAIL PROTECTED], bean=TestSFSB, id=dpsp9lca-7, refs=1, tx=null, synched=null, timeout=5000, queue=[] 2004-01-23 15:20:06,569 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT: In finally 2004-01-23 15:20:06,569 TRACE [org.jboss.ejb.plugins.LogInterceptor] End method=getEJBObject 2004-01-23 15:20:32,559 TRACE [org.jboss.ejb.BeanLockManager] Added ref to lock: [EMAIL PROTECTED], bean=TestSFSB, id=dpsp9lca-7, refs=2, tx=null, synched=null, timeout=5000, queue=[] 2004-01-23 15:20:32,559 WARN [org.jboss.ejb.plugins.AbstractInstanceCache] Unable to passivate due to ctx lock, id=dpsp9lca-7 2004-01-23 15:20:32,559 TRACE [org.jboss.ejb.BeanLockManager] Remove ref lock:[EMAIL PROTECTED], bean=TestSFSB, id=dpsp9lca-7, refs=1, tx=null, synched=null, timeout=5000, queue=[] 2004-01-23 15:20:52,597 TRACE [org.jboss.ejb.BeanLockManager] Added ref to lock: [EMAIL PROTECTED], bean=TestSFSB, id=dpsp9lca-7, refs=2, tx=null, synched=null, timeout=5000, queue=[] 2004-01-23 15:20:52,597 WARN [org.jboss.ejb.plugins.AbstractInstanceCache] Unable to passivate due to ctx lock, id=dpsp9lca-7 2004-01-23 15:20:52,597 TRACE [org.jboss.ejb.BeanLockManager] Remove ref lock:[EMAIL PROTECTED], bean=TestSFSB, id=dpsp9lca-7, refs=1, tx=null, synched=null, timeout=5000, queue=[]