ari-ban / glassfish-genericjmsra

0 stars 0 forks source link

Setting RedeliveryAttempts>0 in a MDB causes exception when the MDB sends a message #40

Closed arinban closed 14 years ago

arinban commented 14 years ago

This bug can be demonstrated using Glassfish 3.0.1 (and the bundled version of MQ),using a MDB which sends a message.

When the outbound resource is enlisted with the XA transaction, the broker complains that the XID is unknown. Here is the full stack trace:

WARNING: [I500]: Caught JVM Exception: com.sun.messaging.jms.JMSException: [START_TRANSACTION_REPLY(45)] [C4036]: A broker error occurred. :[404] Uknown XID 47422D4E443139353837322D30312C7365727665722C50333730302C0003000000658279E647422D4E443139353837322D30312C7365727665722C5033373030 user=guest, broker=localhost:7676(1688) WARNING: [I500]: Caught JVM Exception: com.sun.messaging.jms.JMSException: [START_TRANSACTION_REPLY(45)] [C4036]: A broker error occurred. :[404] Uknown XID 47422D4E443139353837322D30312C7365727665722C50333730302C0002000000658279E647422D4E443139353837322D30312C7365727665722C5033373030 user=guest, broker=localhost:7676(1688) INFO: com.sun.messaging.jms.JMSException: [START_TRANSACTION_REPLY(45)] [C4036]: A broker error occurred. :[404] Uknown XID 47422D4E443139353837322D30312C7365727665722C50333730302C0002000000658279E647422D4E443139353837322D30312C7365727665722C5033373030 user=guest, broker=localhost:7676(1688) at com.sun.messaging.jmq.jmsclient.ProtocolHandler.throwServerErrorException(ProtocolHandler.java:4019) at com.sun.messaging.jmq.jmsclient.ProtocolHandler.startTransaction(ProtocolHandler.java:2744) at com.sun.messaging.jmq.jmsclient.ProtocolHandler.startTransaction(ProtocolHandler.java:2646) at com.sun.messaging.jmq.jmsclient.Transaction.startTransaction(Transaction.java:640) at com.sun.messaging.jmq.jmsclient.Transaction.startXATransaction(Transaction.java:566) at com.sun.messaging.jmq.jmsclient.XAResourceImpl.start(XAResourceImpl.java:863) at com.sun.genericra.outbound.XAResourceProxy.start(XAResourceProxy.java:244) at com.sun.jts.jta.TransactionState.startAssociation(TransactionState.java:312) at com.sun.jts.jta.TransactionImpl.enlistResource(TransactionImpl.java:208) at com.sun.enterprise.transaction.JavaEETransactionImpl.enlistResource(JavaEETransactionImpl.java:608) at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.enlistXAResource(JavaEETransactionManagerSimplified.java:1247) at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.enlistResource(JavaEETransactionManagerSimplified.java:332) at com.sun.enterprise.resource.rm.ResourceManagerImpl.registerResource(ResourceManagerImpl.java:147) at com.sun.enterprise.resource.rm.ResourceManagerImpl.enlistResource(ResourceManagerImpl.java:107) at com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:191) at com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:321) at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:290) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:227) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:159) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:154) at com.sun.genericra.outbound.ConnectionFactory.createConnection(ConnectionFactory.java:75) at com.sun.genericra.outbound.ConnectionFactory.createQueueConnection(ConnectionFactory.java:115) at test.stress.queue.redelivery.ejb.SimpleMessageBean.onMessage(SimpleMessageBean.java:97) 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.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1056) at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1128) at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:4087) at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5272) at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5252) at com.sun.ejb.containers.MessageBeanContainer.deliverMessage(MessageBeanContainer.java:1086) at com.sun.ejb.containers.MessageBeanListenerImpl.deliverMessage(MessageBeanListenerImpl.java:76) at com.sun.enterprise.connectors.inbound.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:166) at $Proxy176.onMessage(Unknown Source) at com.sun.genericra.inbound.async.DeliveryHelper.deliverMessage(DeliveryHelper.java:301) at com.sun.genericra.inbound.async.DeliveryHelper.deliver(DeliveryHelper.java:196) at com.sun.genericra.inbound.async.DeliveryHelper.deliver(DeliveryHelper.java:186) at com.sun.genericra.inbound.async.EndpointConsumer.consumeMessage(EndpointConsumer.java:176) at com.sun.genericra.inbound.async.MessageListener.onMessage(MessageListener.java:56) at com.sun.messaging.jmq.jmsclient.ServerSessionRunner.onMessage(ServerSessionRunner.java:185) at com.sun.messaging.jmq.jmsclient.ServerSessionRunner.run(ServerSessionRunner.java:142) at com.sun.messaging.jmq.jmsclient.SessionImpl.run(SessionImpl.java:3194) at com.sun.genericra.inbound.async.WorkImpl.run(WorkImpl.java:53) at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:92) at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:492) at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:528) Caused by: com.sun.messaging.jms.JMSException: [START_TRANSACTION_REPLY(45)] [C4036]: A broker error occurred. :[404] Uknown XID 47422D4E443139353837322D30312C7365727665722C50333730302C0002000000658279E647422D4E443139353837322D30312C7365727665722C5033373030 user=guest, broker=localhost:7676(1688) at com.sun.messaging.jmq.jmsclient.ProtocolHandler.throwServerErrorException(ProtocolHandler.java:4003) ... 47 more

Environment

Operating System: All Platform: All

Affected Versions

[current]

arinban commented 6 years ago
arinban commented 14 years ago

@glassfishrobot Commented Reported by nigeldeakin

arinban commented 14 years ago

@glassfishrobot Commented binod said: Assign to Satish

arinban commented 14 years ago

@glassfishrobot Commented nigeldeakin said: Allocating to me.

arinban commented 14 years ago

@glassfishrobot Commented nigeldeakin said: This bug is a consequence of the way that message redelivery is implemented in GenericJMSRA. It causes the call to XAResource.start(xid,TMNOFLAGS) on the inbound resource to be deferred until after onMessage() returns successfully.

However this means that if onMessage() attempts to send a message using a second XAResource, and isSameRM() returns true for the two resources, then a call to XAResource.start(xid,TMJOIN) will be called on the second resource before XAResource.start(xid,TMNOFLAGS) has been called on the first resource. As a result, the MQ broker complains that the XID is unknown.

The fix is to force isSameRM() to return false if RedeliveryAttempts>0 and so the call to XAResource.start(xid,TMNOFLAGS) on the inbound resource is deferred.

Tested using test tests/stress.queue.redelivery

arinban commented 14 years ago

@glassfishrobot Commented nigeldeakin said: Fixed in 2.1a

arinban commented 14 years ago

@glassfishrobot Commented Was assigned to nigeldeakin

arinban commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA GENERICJMSRA-40

arinban commented 14 years ago

@glassfishrobot Commented Marked as fixed on Wednesday, September 15th 2010, 2:13:25 am