[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-serviceability-dev
Subject:    CompiledMethodLoad and DynamicCodeGenerated events fired after VMDeath event
From:       Carsten Varming <varming () gmail ! com>
Date:       2015-11-30 22:27:36
Message-ID: CAP_pwnVQOcaLrQDaoHTaAyVtXyE-8fkaOVhqYrgONdaL45=mAA () mail ! gmail ! com
[Download RAW message or body]

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/. 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/

Let me know what you think,
Carsten

[Attachment #3 (text/html)]

<div dir="ltr"><div>Dear Serviceability list,</div><div><br></div>I recently ran into \
an issue discussed in 2009 (<a \
href="http://mail.openjdk.java.net/pipermail/serviceability-dev/2009-February/000736.h \
tml">http://mail.openjdk.java.net/pipermail/serviceability-dev/2009-February/000736.html</a>) \
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).<div><br></div><div>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 <a \
href="http://cr.openjdk.java.net/~cvarming/service_thread.hotspot.00/">http://cr.openjdk.java.net/~cvarming/service_thread.hotspot.00/</a>. \
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.</div><div><br></div><div>The patch also fixes a minor issue with the watcher \
thread where enrolling a task after shutdown can start a new watcher \
thread.</div><div><br></div><div>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 \
(<a href="http://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html">http://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html</a>). \
I started with a few basic events. I can add more events if \
desired.</div><div><br></div><div>I also had to fix  \
make/common/TestFilesCompilation.gmk in the top repo to enable C++ for tests with \
native code. See  <a \
href="http://cr.openjdk.java.net/~cvarming/service_thread.toplevel.00/">http://cr.open \
jdk.java.net/~cvarming/service_thread.toplevel.00/</a></div><div><br></div><div>Let \
me know what you think,</div><div>Carsten</div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic