You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Christopher L. Shannon (JIRA)" <ji...@apache.org> on 2015/07/21 05:00:05 UTC

[jira] [Commented] (AMQ-5896) Problem getting jmx queue when another is deleting during request

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

Christopher L. Shannon commented on AMQ-5896:
---------------------------------------------

Thanks for the report, I was able to reproduce this pretty easy.  This is a little tricky because we can't really add synchronization between the getQueues query and the actual getName() method call where it fails because many asynchronous processes can delete destinations.

It seems like the best thing to do here is to just catch the InstanceNotFoundException and continue checking the rest of the destinations in the list.  If the destination that was being queried was the one deleted then null would be returned which is the same behavior one would expect normally.

I can fix this when I get a chance and I can look at the rest of the class to see if there are any other areas with the same problem.

> Problem getting jmx queue when another is deleting during request
> -----------------------------------------------------------------
>
>                 Key: AMQ-5896
>                 URL: https://issues.apache.org/jira/browse/AMQ-5896
>             Project: ActiveMQ
>          Issue Type: Bug
>            Reporter: Wouter de Vaal
>
> When calling RemoteJMXBrokerFacade to get information on a queue, but while doing this another queue can be removed, leaving the method to throw an exception:
> {noformat}
> Caused by: java.lang.reflect.UndeclaredThrowableException
> 	at com.sun.proxy.$Proxy228.getName(Unknown Source)
> 	at org.apache.activemq.web.BrokerFacadeSupport.getDestinationByName(BrokerFacadeSupport.java:131)
> 	at org.apache.activemq.web.BrokerFacadeSupport.getQueue(BrokerFacadeSupport.java:118)
> 	... 3 more
> Caused by: javax.management.InstanceNotFoundException: org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=20150720083000_82a7f1c6-2eb9-11e5-9d34-0242ac110091
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095)
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:643)
> 	at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)
> 	at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1464)
> 	at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
> 	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
> 	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
> 	at javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:657)
> 	at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
> 	at sun.rmi.transport.Transport$2.run(Transport.java:202)
> 	at sun.rmi.transport.Transport$2.run(Transport.java:199)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at sun.rmi.transport.Transport.serviceCall(Transport.java:198)
> 	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567)
> 	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
> 	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.access$400(TCPTransport.java:619)
> 	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:684)
> 	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:681)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> 	at java.lang.Thread.run(Thread.java:745)
> 	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)
> 	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)
> 	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
> 	at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
> 	at javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(Unknown Source)
> 	at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:906)
> 	at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:267)
> 	... 7 more
> {noformat}
> So what happens is that method getDestinationByName first gets a list of all the queue names. Then it iterates through them when meanwhile a queue gets deleted and thus throwing an exception. Fix should probably be in BrokerFacadeSupport:
> {noformat}
>         protected DestinationViewMBean getDestinationByName(Collection<? extends DestinationViewMBean> collection, String name) {
>             Iterator<? extends DestinationViewMBean> iter = collection.iterator();
>             while (iter.hasNext()) {
>                 DestinationViewMBean destinationViewMBean = iter.next();
>                 try {
>                     String destName = destinationViewMBean.getName();
>                     if (name.equals(destName)) {
>                         return destinationViewMBean;
>                     }
>                 } catch (Exception e){
>                     continue;
>                 }
>             }
>             return null;
>         }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)