activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARTEMIS-1526) ActiveMQServerControl.listConsumers() can fail with NullPointer
Date Tue, 28 Nov 2017 18:59:00 GMT

    [ https://issues.apache.org/jira/browse/ARTEMIS-1526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16269273#comment-16269273
] 

ASF GitHub Bot commented on ARTEMIS-1526:
-----------------------------------------

Github user pgfox commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1675#discussion_r153589625
  
    --- Diff: artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/ConsumerView.java
---
    @@ -45,7 +45,7 @@ public Class getClassT() {
        @Override
        public JsonObjectBuilder toJson(ServerConsumer consumer) {
           ServerSession session = server.getSessionByID(consumer.getSessionID());
    -      JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("id", toString(consumer.sequentialID())).add("session",
toString(session.getName())).add("clientID", toString(session.getRemotingConnection().getClientID())).add("user",
toString(session.getUsername())).add("protocol", toString(session.getRemotingConnection().getProtocolName())).add("queue",
toString(consumer.getQueue().getName())).add("queueType", toString(consumer.getQueue().getRoutingType()).toLowerCase()).add("address",
toString(consumer.getQueue().getAddress().toString())).add("localAddress", toString(session.getRemotingConnection().getTransportConnection().getLocalAddress())).add("remoteAddress",
toString(session.getRemotingConnection().getTransportConnection().getRemoteAddress())).add("creationTime",
new Date(consumer.getCreationTime()).toString());
    +      JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("id", toString(consumer.sequentialID())).add("session",
(session == null ? "" : toString(session.getName()))).add("clientID", (session == null ? ""
: toString(session.getRemotingConnection().getClientID()))).add("user", (session == null ?
"" : toString(session.getUsername()))).add("protocol", (session == null ? "" : toString(session.getRemotingConnection().getProtocolName()))).add("queue",
toString(consumer.getQueue().getName())).add("queueType", toString(consumer.getQueue().getRoutingType()).toLowerCase()).add("address",
toString(consumer.getQueue().getAddress().toString())).add("localAddress", (session == null
? "" : toString(session.getRemotingConnection().getTransportConnection().getLocalAddress()))).add("remoteAddress",
(session == null ? "" : toString(session.getRemotingConnection().getTransportConnection().getRemoteAddress()))).add("creationTime",
new Date(consumer.getCreationTime()).toString());
    --- End diff --
    
    @clebertsuconic originally my thought was to get as much info as possible for the consumer
but your suggestion makes more sense as that consumer will also be closed, so there is no
real point in displaying the available data. 
    
    I will update/test and push it again 
    Thanks
    Pat



> ActiveMQServerControl.listConsumers() can fail with NullPointer 
> ----------------------------------------------------------------
>
>                 Key: ARTEMIS-1526
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1526
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.4.0
>            Reporter: Pat Fox
>            Priority: Minor
>
> race condition between ActiveMQServerControl.listConsumers() and closing client sessions
can cause the following NullPointer 
> {code}
> java.lang.NullPointerException: null
> 	at org.apache.activemq.artemis.core.management.impl.view.ConsumerView.toJson(Unknown
Source)
> 	at org.apache.activemq.artemis.core.management.impl.view.ConsumerView.toJson(Unknown
Source)
> 	at org.apache.activemq.artemis.core.management.impl.view.ActiveMQAbstractView.getResultsAsJson(ActiveMQAbstractView.java:68)
> 	at org.apache.activemq.artemis.core.management.impl.ActiveMQServerControlImpl.listConsumers(ActiveMQServerControlImpl.java:1727)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:483)
> 	at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:483)
> 	at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
> 	at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:112)
> 	at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:46)
> 	at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237)
> 	at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138)
> {code}
> The ActiveMQServerControl.listConsumers() retrieves the associated ServerSession and
this may be null if the session has been closed AFTER the listConsumers() has been called
but BEFORE the session is retrieved.
>  



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message