[jboss-user] [EJB/JBoss] - Locking problem on read only method.

necrolove do-not-reply at jboss.com
Wed Apr 30 08:20:39 EDT 2008


Dear all,  

a stateful session bean publish a simple read only method to produce a payments preview. The method first fetch the accounting positions and than produce the preview (pdf). 
I encountered a problem when this method is required by different clients at the same time. My colleague requested 3 times the preview, the first request complete after 5 minutes while the other two waited for a long time before an exception is raised. 
Here is the stack trace:

java.lang.RuntimeException: Transaction marked for rollback, possibly a timeout
	at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.waitForTx(QueuedPessimisticEJBLock.java:357)
	at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.doSchedule(QueuedPessimisticEJBLock.java:230)
	at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.schedule(QueuedPessimisticEJBLock.java:194)
	at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:100)
	at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:68)
	at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
	at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
	at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
	at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
	at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
	at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
	at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
	at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:527)
	at org.jboss.ejb.Container.invoke(Container.java:954)
	at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:430)
	at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:65)
	at $Proxy736.getId(Unknown Source)
	at com.protrust.inquis.server.commission.CommissionPaymentEngine.keyFor(CommissionPaymentEngine.java:121)
	at com.protrust.inquis.server.commission.CommissionPaymentEngine.keyFor(CommissionPaymentEngine.java:122)
	at com.protrust.inquis.server.commission.CommissionPaymentEngine.put(CommissionPaymentEngine.java:132)
	at com.protrust.inquis.server.commission.CommissionPaymentEngine.addMovements(CommissionPaymentEngine.java:151)
	at com.protrust.inquis.server.commission.CommissionManagerBean.createCommissionPaymentEngines(CommissionManagerBean.java:4376)
	at com.protrust.inquis.server.commission.CommissionManagerBean.createCommissionPaymentsPreview(CommissionManagerBean.java:4260)
	at com.protrust.inquis.server.commission.CommissionManagerBean.createCommissionPaymentsPreview(CommissionManagerBean.java:4336)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
	at org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor.invoke(StatefulSessionContainer.java:598)
	at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
	at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
	at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:330)
	at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
	at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
	at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:378)
	at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
	at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
	at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
	at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
	at org.jboss.ejb.Container.invoke(Container.java:954)
	at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
	at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
	at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
	at sun.reflect.GeneratedMethodAccessor123.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
	at sun.rmi.transport.Transport$1.run(Transport.java:159)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
	at java.lang.Thread.run(Thread.java:619)

Here my configuration:
 - JBoss.4.0.5.GA (I'm using CMP 2.x not EJB3.0)
 - Standard CMP 2.x EntityBean with cache invalidation.
 - TransactionTimeout=18000 (this time is needed for real long transactions).
 - In jboss.xml all the get* are read only.
 - The transaction type of the method is "Supports", the method itself use only gets on entity beans.
 - Each request is performed with a new session context.

Thank you in advance for your help!
Bye
Alessandro


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4147811#4147811

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4147811



More information about the jboss-user mailing list