[jboss-jira] [JBoss JIRA] (AS7-3402) Xnio stream closed after OptimisticLockException

jaikiran pai (JIRA) jira-events at lists.jboss.org
Wed Apr 18 02:40:18 EDT 2012


    [ https://issues.jboss.org/browse/AS7-3402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12685131#comment-12685131 ] 

jaikiran pai commented on AS7-3402:
-----------------------------------

This is what is happening:

1) A client is doing multiple invocations (lets assume 2 invocations, in this example) to a EJB on the server side
2) On the server side this results in 2 threads handling those 2 invocations. Thread A and thread B.
3) Thread A ends up calling the bean method which throws an exception. The server side attempts to write out the exception to the remote channel so that the exception is communicated back to the client. _For some reason_ this write fails for Thread A. One possible reason is some object in the exception instance hierarchy not being serializable. The failure to write out this exception to the remote channel results in an IOException and a subsequent close() on the Channel https://github.com/jbossas/jboss-as/blob/master/ejb3/src/main/java/org/jboss/as/ejb3/remote/protocol/versionone/MethodInvocationMessageHandler.java#L211.
4) Now in the meantime, Thread B which too has invoked on the bean method comes back with an exception of its own from the method invocation. The server is in the process of  writing out the exception to the channel so that its communicated back to the client. Now since Thread A ends up closing the channel when Thread B is writing out a message to the stream, Thread B ends up seeing "stream is closed" error.

What we need to find out is the real exception that's caused in #3 which triggers the failure to write out the message. This will be available in the server.log. 

In general, I am not sure if there's anything we can do about this, since if an IOException occurs while writing out to the channel, the channel is expected to be closed and writes that are currently in progress (in other threads) are bound to fail.

                
> Xnio stream closed after OptimisticLockException
> ------------------------------------------------
>
>                 Key: AS7-3402
>                 URL: https://issues.jboss.org/browse/AS7-3402
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: EJB
>    Affects Versions: 7.1.0.CR1b
>            Reporter: Denis Pavlishin
>            Assignee: jaikiran pai
>            Priority: Blocker
>              Labels: ejb, jboss, xnio
>             Fix For: 7.1.2.Final-redhat1
>
>         Attachments: server.log
>
>
> Sometimes (1 or 2 times a day) I get the following error, after which JBoss not accept remote connections to the EJB module and my application shutdown.
> 18:24:47,114 ERROR [org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler] (pool-9-thread-7) Error invoking method public abstract java.util.Collection ejbserver.session.combat.CombatSession.endCombat(java.lang.Integer) on bean named CombatSessionBean for appname  modulename EjbModule distinctname : javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
> 	at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleEndTransactionException(CMTTxInterceptor.java:115)
> 	at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:95)
> 	at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:232)
> 	at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304)
> 	at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropogatingInterceptor.processInvocation(EJBRemoteTransactionPropogatingInterceptor.java:80)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:57)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
> 	at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
> 	at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.invokeMethod(MethodInvocationMessageHandler.java:283)
> 	at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.access$200(MethodInvocationMessageHandler.java:61)
> 	at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:191)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [:1.6.0_23]
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [:1.6.0_23]
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138) [:1.6.0_23]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_23]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_23]
> 	at java.lang.Thread.run(Thread.java:662) [:1.6.0_23]
> 	at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA]
> Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
> 	at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1174)
> 	at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:119)
> 	at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
> 	at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:92)
> 	... 26 more
> Caused by: javax.persistence.OptimisticLockException
> 	at org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:1382)
> 	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1303)
> 	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1284)
> 	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1290)
> 	at org.hibernate.ejb.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1476)
> 	at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:109)
> 	at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:53)
> 	at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:97)
> 	at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:274)
> 	at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:94)
> 	at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:159)
> 	at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1162)
> 	... 29 more
> Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [ejbserver.jpa.entity.users.User#385952]
> 	at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:2359)
> 	at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3010)
> 	at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2908)
> 	at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3237)
> 	at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:113)
> 	at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:273)
> 	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:265)
> 	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:187)
> 	at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:323)
> 	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
> 	at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1081)
> 	at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:315)
> 	at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:104)
> 	... 35 more
> 18:24:47,117 ERROR [org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler] (pool-9-thread-7) Could not write method invocation failure for method public abstract java.util.Collection ejbserver.session.combat.CombatSession.endCombat(java.lang.Integer) on bean named CombatSessionBean for appname  modulename EjbModule distinctname  due to : java.io.IOException: Stream is closed
> 	at org.xnio.streams.BufferPipeOutputStream.closed(BufferPipeOutputStream.java:61) [xnio-api-3.0.0.CR7.jar:3.0.0.CR7]
> 	at org.xnio.streams.BufferPipeOutputStream.checkClosed(BufferPipeOutputStream.java:67) [xnio-api-3.0.0.CR7.jar:3.0.0.CR7]
> 	at org.xnio.streams.BufferPipeOutputStream.write(BufferPipeOutputStream.java:85) [xnio-api-3.0.0.CR7.jar:3.0.0.CR7]
> 	at org.jboss.remoting3.remote.OutboundMessage.write(OutboundMessage.java:161) [jboss-remoting-3.2.0.CR8.jar:3.2.0.CR8]
> 	at java.io.DataOutputStream.write(DataOutputStream.java:71) [:1.6.0_23]
> 	at org.jboss.as.ejb3.remote.protocol.versionone.AbstractMessageHandler$1.write(AbstractMessageHandler.java:183)
> 	at java.io.FilterOutputStream.write(FilterOutputStream.java:60) [:1.6.0_23]
> 	at java.io.FilterOutputStream.write(FilterOutputStream.java:108) [:1.6.0_23]
> 	at org.jboss.marshalling.SimpleDataOutput.shallowFlush(SimpleDataOutput.java:328) [jboss-marshalling-1.3.4.GA.jar:1.3.4.GA]
> 	at org.jboss.marshalling.river.RiverMarshaller.writeString(RiverMarshaller.java:1445)
> 	at org.jboss.marshalling.river.RiverMarshaller.writeNewSerializableClass(RiverMarshaller.java:1356)
> 	at org.jboss.marshalling.river.RiverMarshaller.writeSerializableClass(RiverMarshaller.java:1339)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:877)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1057)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1013)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:879)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1057)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1013)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:879)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1057)
> 	at org.jboss.marshalling.river.RiverObjectOutputStream.defaultWriteObject(RiverObjectOutputStream.java:159)
> 	at java.lang.Throwable.writeObject(Throwable.java:648) [:1.6.0_23]
> 	at sun.reflect.GeneratedMethodAccessor479.invoke(Unknown Source) [:1.6.0_23]
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_23]
> 	at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_23]
> 	at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:173) [jboss-marshalling-1.3.4.GA.jar:1.3.4.GA]
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1001)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:992)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:992)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:879)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1057)
> 	at org.jboss.marshalling.river.RiverObjectOutputStream.defaultWriteObject(RiverObjectOutputStream.java:159)
> 	at java.lang.Throwable.writeObject(Throwable.java:648) [:1.6.0_23]
> 	at sun.reflect.GeneratedMethodAccessor479.invoke(Unknown Source) [:1.6.0_23]
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_23]
> 	at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_23]
> 	at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:173) [jboss-marshalling-1.3.4.GA.jar:1.3.4.GA]
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1001)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:992)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:992)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:992)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:992)
> 	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:879)
> 	at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62) [jboss-marshalling-1.3.4.GA.jar:1.3.4.GA]
> 	at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:119) [jboss-marshalling-1.3.4.GA.jar:1.3.4.GA]
> 	at org.jboss.as.ejb3.remote.protocol.versionone.AbstractMessageHandler.writeException(AbstractMessageHandler.java:100)
> 	at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:195)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [:1.6.0_23]
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [:1.6.0_23]
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138) [:1.6.0_23]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_23]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_23]
> 	at java.lang.Thread.run(Thread.java:662) [:1.6.0_23]
> 	at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA]
> Caused by: an exception which occurred:
> 	in field friends
> 	in field entity
> 	in field cause
> 	in field cause
> 	in object javax.ejb.EJBTransactionRolledbackException at 6e2b05ea

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list