Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-9288

JMX related failures in spring-context tests

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2 M1
    • Fix Version/s: 3.2 RC2
    • Component/s: [Build]
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      The failure occurs when I run all spring-context tests from the command line. It doesn't fail when running the test alone, the tests in the same package, or all tests inside Eclipse.

      The test creates an MBeanServer via javax.management.MBeanServerFactory, then tries to check if an MBeanServerFactoryBean will locate that same instance. The assertSame on line 65 fails because more than one MBeanServer instances were found and the first one returned was not the same instance.

      Running gradle in debug mode and using breakpoints in addMBeanServer() and removeMBeanServer() of MBeanServerFactory, I was able to find one case where an MBeanServer is added but not removed. It happens in AdvisedJRubyScriptFactoryTests inside JRuby itself when Spring tries to load a script via JRubyScriptFactory. So it looks like a side effect, which explains why the failure doesn't occur when running a single test but not why it doesn't fail inside Eclipse.

      I experimented with a tearDown() method in AdvisedJRubyScriptFactoryTests, which looks for and releases any MBeanServers it finds but that caused a failure in JmxUtilsTests.testLocatePlatformMBeanServer. So clearly not a good fix. Furthermore the fact this is an environment-sensitive issue makes even more hesitant to go any further.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pwebb Phil Webb
                Reporter:
                rstoya05-aop Rossen Stoyanchev
                Last updater:
                Phil Webb
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 30 weeks ago