[
http://jira.jboss.com/jira/browse/JBAS-4204?page=all ]
Adrian Brock updated JBAS-4204:
-------------------------------
Summary: Don't allow removal of durable topic subscriptions when there are
active subscribers or unacknowledged messages (was: BasicQueue.removeAllMessages is not
handling msgs with timeouts that are unacked)
Fix Version/s: (was: JBossAS-4.2.0.GA)
Description:
According to the spec, it is an application error to unsubscribe a Durable Topic
Subscription
when there is an active subscriber or there are unacknowledged messages/uncommitted
transactions for the subscription.
We don't currently check for this condition, except that it can lead to an NPE
if somebody does it which will then might also leave the state manager in an inconsistent
state
(it can only be fixed by rebooting).
Since this is an application error, the application should receive an error
(javax.jms.IllegalStateException) if it is tried.
It should not lead to corrupted server state.
The code already exists for this (related to disallowing the deletion of temporary queues
with
active subscribers) so it is just a case of:
1) Updating the "inUse" check in BasicQueue to also look for unacknowledged
messages
(this also covers uncommitted transactions). This check also applies to temporary
queues/topics.
2) Adding the code to check "inUse" in JMSTopic.destroyDurableSubscription()
before doing the removeAllMessages().
was:
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);
}
}
Don't allow removal of durable topic subscriptions when there are
active subscribers or unacknowledged messages
---------------------------------------------------------------------------------------------------------------
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.3 SP1, JBossAS-4.0.5.GA, JBossAS-4.0.4.GA
Reporter: Scott M Stark
Assigned To: Adrian Brock
Fix For: JBossAS-4.0.5.SP1 , JBossAS-4.2.0.GA, JBossAS-5.0.0.Beta2
According to the spec, it is an application error to unsubscribe a Durable Topic
Subscription
when there is an active subscriber or there are unacknowledged messages/uncommitted
transactions for the subscription.
We don't currently check for this condition, except that it can lead to an NPE
if somebody does it which will then might also leave the state manager in an inconsistent
state
(it can only be fixed by rebooting).
Since this is an application error, the application should receive an error
(javax.jms.IllegalStateException) if it is tried.
It should not lead to corrupted server state.
The code already exists for this (related to disallowing the deletion of temporary queues
with
active subscribers) so it is just a case of:
1) Updating the "inUse" check in BasicQueue to also look for unacknowledged
messages
(this also covers uncommitted transactions). This check also applies to temporary
queues/topics.
2) Adding the code to check "inUse" in JMSTopic.destroyDurableSubscription()
before doing the removeAllMessages().
--
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