(XS) RFR: 8146222: assert(_initialized) failed: TLS not initialized yet!

David Holmes david.holmes at oracle.com
Fri Jan 8 04:01:05 UTC 2016


Bug: https://bugs.openjdk.java.net/browse/JDK-8146222

webrev: http://cr.openjdk.java.net/~dholmes/8146222/webrev/

JDK-8144947 showed an error path, on Windows, where we can call 
Thread::current_or_null before TLS has been initialized and so hit the 
assertion failure - see bug report for details.

Simple fix is to move the ThreadLocalStorage::init() prior to any 
argument parsing code. As it contains simple OS library calls it can be 
initialized very early. Even the asserts in it still work (somewhat 
surprisingly) after the move.

Failure mode of 
com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java before the fix:

Agent[1].stdout: ## nof_mallocs = 674, nof_frees = 38
Agent[1].stdout: ## memory stomp:
Agent[1].stdout: GuardedMemory(0x0000000000fbf690) 
base_addr=0x0000000000fbf3f0 tag=0x00000000000da360 user_size=16512112 
user_data=0x0000000000fbf410
Agent[1].stdout: Header guard @0x0000000000fbf3f0 is BROKEN
Agent[1].stdout: # To suppress the following error report, specify this 
argument
Agent[1].stdout: # after -XX: or in .hotspotrc: 
SuppressErrorAt=\threadLocalStorage_windows.cpp:52
Agent[1].stdout: #
Agent[1].stdout: # A fatal error has been detected by the Java Runtime 
Environment:
Agent[1].stdout: #
Agent[1].stdout: # Internal Error 
(C:\jprt\T\P1\020042.daholme\s\hotspot\src\os\windows\vm\threadLocalStorage_windows.cpp:52), 
pid=5076, tid=4348
Agent[1].stdout: # assert(_initialized) failed: TLS not initialized yet!

Failure mode after:

Agent[1].stdout: ## nof_mallocs = 601, nof_frees = 36
Agent[1].stdout: ## memory stomp:
Agent[1].stdout: GuardedMemory(0x00f1fc44) base_addr=0x00f1fb40 
tag=0x003a9bc0 user_size=1942466404 user_data=0x00f1fb58
Agent[1].stdout: Header guard @0x00f1fb40 is BROKEN
Agent[1].stdout: #
Agent[1].stdout: # A fatal error has been detected by the Java Runtime 
Environment:
Agent[1].stdout: #
Agent[1].stdout: # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at 
pc=0x73bb8ab6, pid=10328, tid=7672

Testing:
   - JPRT
   - com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java
   - testing that the asserts in the relocated init() method fire correctly

Thanks,
David


More information about the hotspot-runtime-dev mailing list