Menu

Exception in "EMMA shutdown handler thread"

juan-marco
2005-02-17
2013-05-09
  • juan-marco

    juan-marco - 2005-02-17

    Hi,
    First, thank's a lot, great stuff
    When I try to use emma with cactus I got this error :
       [cactus] 17 fvr. 2005 11:54:38 org.apache.coyote.http11.Http11Protocol pause
       [cactus] INFO : Suspension de Coyote HTTP/1.1 sur http-9090
       [cactus] 17 fvr. 2005 11:54:39 org.apache.catalina.core.StandardService stop
       [cactus] INFO : Arrt du service Catalina
       [cactus] 17 fvr. 2005 11:54:39 org.apache.coyote.http11.Http11Protocol destroy
       [cactus] INFO : Arrt de Coyote HTTP/1.1 sur http-9090
       [cactus] 17 fvr. 2005 11:54:39 org.apache.catalina.loader.WebappClassLoader loadClass
       [cactus] INFO: Illegal access: this web application instance has been stopped already.  Could not load java.io.RandomAccessFile.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
       [cactus] java.lang.ThreadDeath
       [cactus] at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1221)
       [cactus] at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
       [cactus] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
       [cactus] at com.vladium.emma.data.DataFactory.persist(DataFactory.java:656)
       [cactus] at com.vladium.emma.data.DataFactory.persist(DataFactory.java:86)
       [cactus] at com.vladium.emma.rt.RTCoverageDataPersister.dumpCoverageData(RTCoverageDataPersister.java:54)
       [cactus] at com.vladium.emma.rt.RTExitHook.run(RTExitHook.java:32)
       [cactus] at java.lang.Thread.run(Thread.java:595)
       [cactus] Exception in thread "EMMA shutdown handler thread" java.lang.RuntimeException: EMMA failed to dump coverage data: java.lang.ThreadDeath
       [cactus] at com.vladium.emma.rt.RTCoverageDataPersister.dumpCoverageData(RTCoverageDataPersister.java:71)
       [cactus] at com.vladium.emma.rt.RTExitHook.run(RTExitHook.java:32)
       [cactus] at java.lang.Thread.run(Thread.java:595)

     
    • juan-marco

      juan-marco - 2005-02-17

      I temporarily solve this problem by adding a tearDown function into cactus test to flush coverage
      @Override protected void tearDown() throws Exception {
          com.vladium.emma.rt.RT.dumpCoverageData(new File(
              "/abs/path/to/coverage.emma"), true, false);
        }

      I still search for a solution with no intrusion in source code

       
    • Vlad Roubtsov

      Vlad Roubtsov - 2005-02-17

      I know exactly what happens here. The instrumented web app registers a shutdown hook to dump coverage on JVM exit. Because the webapp is deactivated by the container before exit hooks run, catalina classloader refuses to do any more classloading (even though it is for a core class like java.io.RandomAccessFile that is always loadable).

      I can see that relying on exit hooks will remain unreliable in J2EE containers (hence an exiting RFE for other means to dump coverage). For now, the only workarounds are:

      (a) make use of the dumpCoverageData() method prior to JVM exit, as you already have

      (b) deploy emma.jar as a non-app library: as a JRE extension or as a container "system" library. (so that emma.jar is loaded by a non-webapp loader, like what you would do for JDBC drivers, etc).

      Vlad.

       

Log in to post a comment.