Carsten,

Maybe this bug:

JDK-8067876 demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java
            fails due to 112(JVMTI_ERROR_WRONG_PHASE)
https://bugs.openjdk.java.net/browse/JDK-8067876

at least for the JVM/TI phase part...

Dan



On 11/30/15 3:27 PM, Carsten Varming wrote:
Dear Serviceability list,

I recently ran into an issue discussed in 2009 (http://mail.openjdk.java.net/pipermail/serviceability-dev/2009-February/000736.html) where the JVMTI events CompiledMethodLoad and DynamicCodeGenerated are emitted after the VM has switched to the dead phase. Is there a bug for this issue somewhere (I was unable to find one).

I suggest we fix the issue by shutting down the service thread just before emitting the VMDeath event in hotspot/src/share/vm/runtime/java.cpp:before_exit. I have put a patch here http://cr.openjdk.java.net/~cvarming/service_thread.hotspot.00/ <http://cr.openjdk.java.net/%7Ecvarming/service_thread.hotspot.00/>. With the patch before_exit request the service thread to shut down in much the same way before_exit requests the watcher thread to shut down. The service thread will complete any outstanding work before recognizing the request to shut down.

The patch also fixes a minor issue with the watcher thread where enrolling a task after shutdown can start a new watcher thread.

The patch also contains a test with a JVMTI agent that checks that events are fired in the right phases as specified in the JVMTI doc (http://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html). I started with a few basic events. I can add more events if desired.

I also had to fix make/common/TestFilesCompilation.gmk in the top repo to enable C++ for tests with native code. See http://cr.openjdk.java.net/~cvarming/service_thread.toplevel.00/ <http://cr.openjdk.java.net/%7Ecvarming/service_thread.toplevel.00/>

Let me know what you think,
Carsten

Reply via email to