JDK-8211821 : PrintStringTableStatistics crashes JVM
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 11,12
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-10-06
  • Updated: 2019-09-06
  • Resolved: 2018-10-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12
11.0.3-oracleFixed 12 b16Fixed
Related Reports
Duplicate :  
Relates :  
Description
Running java -XX:+PrintStringTableStatistics results in EXCEPTION_ACCESS_VIOLATION during JVM shutdown.

fastdebug build fails on the following assertion:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (c:\Users\Andrei\java\jdk\src\hotspot\share\runtime/thread.hpp:740), pid=5480, tid=3572
#  assert(current != 0LL) failed: Thread::current() called on detached thread
#
# JRE version: OpenJDK Runtime Environment (11.0+28) (fastdebug build 11+28)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 12-internal+0-adhoc..jdk, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)

String table is dumped after the last thread exits, but SymbolTable::dump() still calls Thread::current() which returns NULL.

V  [jvm.dll+0xd90f04]  VMError::report_and_die+0x64  (vmerror.cpp:1269)
V  [jvm.dll+0x594ffe]  report_vm_error+0x7e  (debug.cpp:233)
V  [jvm.dll+0x1681b]  Thread::current+0x5b  (thread.hpp:740)
V  [jvm.dll+0xcd55d7]  SymbolTable::dump+0x27  (symboltable.cpp:617)
V  [jvm.dll+0x750d1f]  exit_globals+0x3f  (init.cpp:176)
V  [jvm.dll+0xd2a840]  Threads::destroy_vm+0x380  (thread.cpp:4309)
V  [jvm.dll+0x7f9237]  jni_DestroyJavaVM+0xb7  (jni.cpp:4100)

Comments
Fix Request Backporting this fix enables printing the performance-critical information out of the VM. Patch applies cleanly to 11u, and passes hotspot tier1 tests, including new test. I also verified the VM option works by hand.
15-02-2019

This issue introduced in JDK 11 ea b16 possibly due to JDK-8195097. The fix is addressed only in 12, adding 11-bp, usage of "-XX:+PrintStringTableStatistics" is still broken in 11u Please check this - JDK-8214000
16-11-2018

Function exit_globals() dumps the Symbol table and then dumps the String table. In JDK-11, dumping the Symbol table succeeds (because JDK-8195100 is only in JDK-12) but the JVM then crashes when dumping the String table. Dumping the String table in JDK-11 fails for the same reason that dumping the Symbol table fails in JDK-12. The code tries to access current thread, but current thread has already been deleted. The fix for JDK-12 also works for JDK-11. Should this fix be back-ported to JDK-11 ?
11-10-2018

JDK 11 also crashes, but JDK-8195100 is pushed only to JDK 12, so the cause for JDK 11 is different and *might* require a different fix. The crash stack is here (probably because the lock has been deleted). #17 <signal handler called> #18 0x00007ffff68ccd7d in Monitor::try_lock() () from /tmp/jdk11/jdk-11/lib/server/libjvm.so #19 0x00007ffff6a3585e in StringTable::dump(outputStream*, bool) () from /tmp/jdk11/jdk-11/lib/server/libjvm.so #20 0x00007ffff65619dc in exit_globals() () from /tmp/jdk11/jdk-11/lib/server/libjvm.so #21 0x00007ffff6ad6add in Threads::destroy_vm() () from /tmp/jdk11/jdk-11/lib/server/libjvm.so #22 0x00007ffff6606318 in jni_DestroyJavaVM () from /tmp/jdk11/jdk-11/lib/server/libjvm.so #23 0x00007ffff7793d24 in JavaMain () from /tmp/jdk11/jdk-11/bin/../lib/jli/libjli.so #24 0x00007ffff79a76fa in start_thread (arg=0x7ffff7fc8700) at pthread_create.c:333 #25 0x00007ffff72c8b5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
10-10-2018

In JDK-9, SymbolTable::dump() did not have a ResourceMark nor did it call Thread::current(). So the symbol table dump could be done after deleting the thread. The thread gets deleted by the "delete thread;" statement in Threads::destroy_vm(). This happens before the call to exit_globals(). Function exit_globals() calls SymbolTable::dump(), which now calls Thread::current(). This change was done in JDK-8195100. Perhaps destroy_vm() can call exit_globals() before deleting the thread.
10-10-2018

Reproducible on Linux as well.
09-10-2018