Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-5896

Problem getting jmx queue when another is deleting during request

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 5.12.0
    • None
    • None

    Description

      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:

      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
      

      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:

              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;
              }
      

      Attachments

        Activity

          People

            cshannon Christopher L. Shannon
            wouterv Wouter de Vaal
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: