RFR: JDK-8033696: "assert(thread != NULL) failed: just checking" due to Thread::current() and JNI pthread interaction
Andreas Eriksson
andreas.eriksson at oracle.com
Mon Feb 10 08:21:41 PST 2014
Hi,
Could I please get reviews for this change.
JBS: https://bugs.openjdk.java.net/browse/JDK-8033696
Webrev: http://cr.openjdk.java.net/~aeriksso/8033696/webrev.00/
Mail discussion:
http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2014-February/010759.html
Summary:
JNI code is using pthread_key_create with a destructor to detach the
thread from the JVM when the thread is exiting.
For some flavors of Linux and BSD the JVM is also using the
pthread_key_create, to store the Thread::current() value in a thread
local storage.
Since the thread local storage containing the thread pointer is erased
(by pthread) before the JNI destructor runs, we run detachCurrentThread
on a thread that has NULL as current thread.
This fix uses a destructor for the thread pointer that restores the
value, so that the JNI destructor can run detachCurrentThread successfully.
More info in JBS.
Testing:
Native code regtest attached to JBS tested on Linux, but not on Mac
since I don't have access to one.
JPRT ran without a problem.
Regards,
Andreas
More information about the hotspot-runtime-dev
mailing list