Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-1039

Intermittent failure in notification listener testing in org.jboss.as.jmx.rbac.JmxRbacEnabledTestCase

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.0.0.CR7
    • 2.0.0.CR6
    • JMX, Test Suite
    • None

      For a while we've seen rare failures of JMX tests that look like this:

      java.lang.RuntimeException: java.security.PrivilegedActionException: javax.management.ListenerNotFoundException: Unknown listener
          at org.jboss.as.jmx.rbac.JmxRbacTestCase.checkMBeanAccess(JmxRbacTestCase.java:484)
          at org.jboss.as.jmx.rbac.JmxRbacTestCase.testMonitorNonSensitiveMBeans(JmxRbacTestCase.java:219)
         ...
      Caused by: java.security.PrivilegedActionException: null
          at java.security.AccessController.doPrivileged(Native Method)
          at javax.security.auth.Subject.doAs(Subject.java:422)
          at org.jboss.as.jmx.rbac.JmxRbacTestCase.checkMBeanAccess(JmxRbacTestCase.java:254)
          at org.jboss.as.jmx.rbac.JmxRbacTestCase.testMonitorNonSensitiveMBeans(JmxRbacTestCase.java:219)
         ...
      Caused by: javax.management.ListenerNotFoundException: Unknown listener
          at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.removeNotificationListener(DefaultMBeanServerInterceptor.java:1339)
          at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.removeNotificationListener(DefaultMBeanServerInterceptor.java:1242)
          at com.sun.jmx.mbeanserver.JmxMBeanServer.removeNotificationListener(JmxMBeanServer.java:870)
          at org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.removeNotificationListener(PluggableMBeanServerImpl.java:1544)
          at org.jboss.as.jmx.PluggableMBeanServerImpl.removeNotificationListener(PluggableMBeanServerImpl.java:969)
          at org.jboss.as.jmx.rbac.JmxRbacTestCase$1.run(JmxRbacTestCase.java:368)
          at org.jboss.as.jmx.rbac.JmxRbacTestCase$1.run(JmxRbacTestCase.java:254)
          at java.security.AccessController.doPrivileged(Native Method)
          at javax.security.auth.Subject.doAs(Subject.java:422)
          at org.jboss.as.jmx.rbac.JmxRbacTestCase.checkMBeanAccess(JmxRbacTestCase.java:254)
          at org.jboss.as.jmx.rbac.JmxRbacTestCase.testMonitorNonSensitiveMBeans(JmxRbacTestCase.java:219)
      

      The problem is the TestModelMBean used by the test is not holding a ref to the "listenerWrapper" that the JVM MBeanServer passes into its addNotificationListener method. That allows that listenerWrapper to be gc'd, resulting in the failure of the removeNotificationListener call on the next line of the test.

      The test holding a ref to the listener doesn't matter, as it's a "listenerWrapper" object that matters.

              bstansbe@redhat.com Brian Stansberry
              bstansbe@redhat.com Brian Stansberry
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: