[ 
https://issues.apache.org/jira/browse/ARTEMIS-1670?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

clebert suconic updated ARTEMIS-1670:
-------------------------------------
    Fix Version/s: 1.5.6

> NPE was found in when dropping durable subscriptions from a topic
> -----------------------------------------------------------------
>
>                 Key: ARTEMIS-1670
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1670
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 1.5.5
>            Reporter: Lin Gao
>            Priority: Major
>             Fix For: 1.5.6
>
>
> In WildFly, set up a topic by executing following CLI:
> {code:java}
> /subsystem=messaging-activemq/server=default:write-attribute(name=security-enabled,value=false)
> :reload
> /subsystem=messaging-activemq/server=default/jms-topic=testTopic:add(entries=[java:/jms/topic/testTopic,
>  java:jboss/exported/jms/topic/testTopic])
> {code}
> Then create a durable subscriber on it using the following test code:
>   
> {code:java}
>     public static void main(String[] args) throws Exception {
>       Connection connection = null;
>         Context namingContext = null;
>         try {
>             final Properties env = new Properties();
>             env.put(Context.INITIAL_CONTEXT_FACTORY, 
> "org.wildfly.naming.client.WildFlyInitialContextFactory");
>             env.put(Context.PROVIDER_URL, 
> System.getProperty(Context.PROVIDER_URL, "http-remoting://127.0.0.1:8080"));
>             namingContext = new InitialContext(env);
>             Topic topic = (Topic) 
> namingContext.lookup("/jms/topic/testTopic");
>             ConnectionFactory connectionFactory = (ConnectionFactory) 
> namingContext.lookup("jms/RemoteConnectionFactory");
>             connection = connectionFactory.createConnection();
>             connection.setClientID("durable-client");
>             connection.start();
>             Session session = connection.createSession(false, 
> Session.AUTO_ACKNOWLEDGE);
>             MessageProducer messageProducer = session.createProducer(topic);
>             TopicSubscriber subscriber = 
> session.createDurableSubscriber(topic, "subscriber-1");
>             TextMessage message1 = session.createTextMessage("This is a text 
> message 1");
>             messageProducer.send(message1);
>             System.out.println("Sent message: " + message1.getText());
>             TextMessage messageReceived = (TextMessage) subscriber.receive();
>             System.out.println("Received message: " + 
> messageReceived.getText());
>             try {
>                               Thread.sleep(20000); // wait 20 seconds before 
> un-subscribe
>                       } catch (InterruptedException e) {
>                               e.printStackTrace();
>                       }
>             subscriber.close();
>             session.unsubscribe("subscriber-1");
>         } finally {
>                       if (connection != null) {
>                               connection.close();
>                       }
>             if (namingContext != null) {
>               namingContext.close();
>             }
>         }
>     }
> {code}
>  
>  The code above will sleep 20 seconds before un-subscribe, try to execute the 
> following WildFly CLI within 20 seconds:
> {code:java}
> /subsystem=messaging-activemq/server=default/jms-topic=testTopic:drop-durable-subscription(client-id=durable-client,
>  subscription-name=subscriber-1)
> {code}
>  
>  The WildFly CLI succeeded, but there is a NPE in the server log:
> {code:java}
> 09:10:42,340 ERROR [org.apache.activemq.artemis.core.server] (Thread-3 
> (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$3@7ba46694))
>  AMQ224065: Failed to remove auto-created queue 
> testSubscriberClientIdjmsTopicOperations.testSubscriber: 
> java.lang.NullPointerException
>       at 
> org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl$JMSQueueDeleter.delete(JMSServerManagerImpl.java:1669)
>  [artemis-jms-server-1.5.5.008-redhat-1.jar:1.5.5.008-redhat-1]
>       at 
> org.apache.activemq.artemis.core.server.impl.AutoCreatedQueueManagerImpl$1.run(AutoCreatedQueueManagerImpl.java:36)
>  [artemis-server-1.5.5.008-redhat-1.jar:1.5.5.008-redhat-1]
>       at 
> org.apache.activemq.artemis.utils.ReferenceCounterUtil.decrement(ReferenceCounterUtil.java:54)
>  [artemis-commons-1.5.5.008-redhat-1.jar:1.5.5.008-redhat-1]
>       at 
> org.apache.activemq.artemis.core.server.impl.AutoCreatedQueueManagerImpl.decrement(AutoCreatedQueueManagerImpl.java:58)
>  [artemis-server-1.5.5.008-redhat-1.jar:1.5.5.008-redhat-1]
>       at 
> org.apache.activemq.artemis.core.server.impl.QueueImpl.removeConsumer(QueueImpl.java:786)
>  [artemis-server-1.5.5.008-redhat-1.jar:1.5.5.008-redhat-1]
>       at 
> org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl.removeItself(ServerConsumerImpl.java:496)
>  [artemis-server-1.5.5.008-redhat-1.jar:1.5.5.008-redhat-1]
>       at 
> org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl.close(ServerConsumerImpl.java:443)
>  [artemis-server-1.5.5.008-redhat-1.jar:1.5.5.008-redhat-1]
>       at 
> org.apache.activemq.artemis.core.server.impl.ServerSessionImpl.closeConsumer(ServerSessionImpl.java:1174)
>  [artemis-server-1.5.5.008-redhat-1.jar:1.5.5.008-redhat-1]
>       at 
> org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.internalHandlePacket(ServerSessionPacketHandler.java:445)
>  [artemis-server-1.5.5.008-redhat-1.jar:1.5.5.008-redhat-1]
>       at 
> org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.lambda$handlePacket$0(ServerSessionPacketHandler.java:211)
>  [artemis-server-1.5.5.008-redhat-1.jar:1.5.5.008-redhat-1]
>       at 
> org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:122)
>  [artemis-commons-1.5.5.008-redhat-1.jar:1.5.5.008-redhat-1]
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>  [rt.jar:1.8.0_151]
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>  [rt.jar:1.8.0_151]
>       at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_151]
> {code}
> Despite this error, *subscription is removed* and listing of all 
> subscriptions is now empty. Operation works as expected, however there is an 
> Error logged on server side.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to