[jboss-jira] [JBoss JIRA] Created: (JBAS-4204) BasicQueue.removeAllMessages is not handling msgs with timeouts that are unacked

Scott M Stark (JIRA) jira-events at lists.jboss.org
Wed Mar 14 18:44:32 EDT 2007


BasicQueue.removeAllMessages is not handling msgs with timeouts that are unacked
--------------------------------------------------------------------------------

                 Key: JBAS-4204
                 URL: http://jira.jboss.com/jira/browse/JBAS-4204
             Project: JBoss Application Server
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: JMS service
    Affects Versions: JBossAS-4.0.5.GA, JBossAS-4.0.4.GA, JBossAS-4.0.3 SP1
            Reporter: Scott M Stark
         Assigned To: Adrian Brock
             Fix For: JBossAS-4.2.0.GA


There is an inconsistency with the way message removal is done when msgs with expirations that are unacked. The problem is that the call to dropMessage(message) for the timeout event clears the MessageReference when its removed from the cache. When the unacknowledgedMessages are then processed, the associated MessageReference has been nulled out, and the following NPE results:

java.lang.NullPointerException
	at org.jboss.mq.server.MessageReference.redelivered(MessageReference.java:180)
	at org.jboss.mq.server.BasicQueue.nackMessage(BasicQueue.java:382)
	at org.jboss.mq.server.BasicQueue$RestoreMessageTask.run(BasicQueue.java:1115)
	at org.jboss.mq.pm.TxManager.addPostCommitTask(TxManager.java:103)
	at org.jboss.mq.server.BasicQueue.acknowledge(BasicQueue.java:558)
	at org.jboss.mq.server.BasicQueue.removeAllMessages(BasicQueue.java:651)
	at org.jboss.mq.server.JMSTopic.destroyDurableSubscription(JMSTopic.java:315)
	at org.jboss.mq.sm.AbstractStateManager.setDurableSubscription(AbstractStateManager.java:119)
	at org.jboss.mq.server.JMSDestinationManager.destroySubscription(JMSDestinationManager.java:620)
	at org.jboss.mq.server.JMSServerInterceptorSupport.destroySubscription(JMSServerInterceptorSupport.java:261)
	at org.jboss.mq.security.ServerSecurityInterceptor.destroySubscription(ServerSecurityInterceptor.java:197)
	at org.jboss.mq.server.TracingInterceptor.destroySubscription(TracingInterceptor.java:661)
	at org.jboss.mq.server.JMSServerInvoker.destroySubscription(JMSServerInvoker.java:261)
	at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:183)
	at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:369)
	at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:377)
	at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
	at java.lang.Thread.run(Thread.java:534)

This appears to be caused by an invalid attempt to unsubscribe a durable subscription, however, the failure results in the not being able to reestablish the subscription latter:

2007-02-08 07:50:03,373 ERROR [org.jboss.mq.il.uil2.SocketManager] Failed to handle: org.jboss.mq.il.uil2.msgs.SubscribeMsg26446166[msgType: m_subscribe, msgID: 5, error: null]
java.lang.NullPointerException
at org.jboss.mq.server.JMSTopic.addSubscriber(JMSTopic.java:104)
at org.jboss.mq.server.ClientConsumer.addSubscription(ClientConsumer.java:133)
at org.jboss.mq.server.JMSDestinationManager.subscribe(JMSDestinationManager.java:596)
at org.jboss.mq.server.JMSServerInterceptorSupport.subscribe(JMSServerInterceptorSupport.java:297)
at org.jboss.mq.security.ServerSecurityInterceptor.subscribe(ServerSecurityInterceptor.java:142)
at org.jboss.mq.server.TracingInterceptor.subscribe(TracingInterceptor.java:769)
at org.jboss.mq.server.JMSServerInvoker.subscribe(JMSServerInvoker.java:297)
at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:166)
at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:369)
at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:377)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
at java.lang.Thread.run(Thread.java:534) 

The problem here is that the handling of the unsubscribe in AbstractStateManager.setDurableSubscription results in the durQueues being removed in JMSTopic.destroyDurableSubscription, but the AbstractStateManager.removeDurableSubscription(subscription) is not called because of the previous NPE.

Presumably the cleanup in AbstractStateManager.setDurableSubscription should be doing:
            try
            {
               dest.destroyDurableSubscription(sub);
            }
            finally
            {
               try
               {
                  // straight deletion, remove subscription - call subclass
                  removeDurableSubscription(subscription);
               }
               catch(Throwable t)
               {
                  log.warn("Failed to remove subscription: "+subscription, t);
               }
            }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list