RFR: 8269934: RunThese24H.java failed with EXCEPTION_ACCESS_VIOLATION in java_lang_Thread::get_thread_status
David Holmes
dholmes at openjdk.java.net
Wed Jul 28 10:12:49 UTC 2021
If a thread is attaching via JNI and has not yet created its Thread object it can be caught in a ThreadSnapshot during a thread dump (VM_DumpThreads) of all threads**, and the threadObj() will be NULL, so we can't pass it to get_thread_status().
** JMM dumpThreads API
The initial fix simply checks for a NULL threadObj() and reports thread status NEW in that case.
Alternatively we could filter the attaching thread out completely in VM_DumpThreads::doit by expanding:
if (jt->is_exiting() ||
jt->is_hidden_from_external_view()) {
// skip terminating threads and hidden threads
continue;
}
to also check jt->is_attaching_via_jni().
Note that higher-level code already filters out ThreadSnapshots with NULL threadObj() anyway so we could go either way.
Testing: manual hacks - see bug report.
- tier 1-3 sanity testing
Thanks,
David
-------------
Commit messages:
- 8269934: RunThese24H.java failed with EXCEPTION_ACCESS_VIOLATION in java_lang_Thread::get_thread_status
Changes: https://git.openjdk.java.net/jdk/pull/4921/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4921&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8269934
Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/4921.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/4921/head:pull/4921
PR: https://git.openjdk.java.net/jdk/pull/4921
More information about the serviceability-dev
mailing list