United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6583275 Hotspot crash in vm_perform_shutdown_actions due to uninitialized TLS during out of memory handling
JDK-6583275 : Hotspot crash in vm_perform_shutdown_actions due to uninitialized TLS during out of memory handling

Details
Type:
Bug
Submit Date:
2007-07-20
Status:
Closed
Updated Date:
2011-04-23
Project Name:
JDK
Resolved Date:
2011-04-23
Component:
hotspot
OS:
linux
Sub-Component:
runtime
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
hs20 (b06)

Related Reports
Backport:
Backport:

Sub Tasks

Description
The VM crashes on the way to reporting an out of memory condition.  This happens during thread creation, before TLS is initialized.  It could be a missing NULL check in vm_perform_shutdown_actions() after a call to Thread::current().  ###@###.### suggested that vm_perform_shutdown_actions() should probably use TLS:get_thread_slow().

                                    

Comments
EVALUATION

I believe the crash stack pointed out in the comments section comes from Linux platform. The root cause of the crash is the Thread object getting from Thread::current() call is NULL since the fast path for retrieving the Thread object from the internal array (caching the known Thread objects) fails. 

To be a little bit more in detail, there is a array used internally for caching the Thread objects created. The array index for these Thread object is carefully choosen. There might be crash before inserting the Thread object into that array and as a result, it might cause The fast path of retrieving the Thread object to return NULL.

As a good practice, in the possible VM exit path, we should program defensively to consider that possibility. So the fix would be as simple as falling back to slow path when Thread returned from Thread::current is NULL.
                                     
2007-11-01
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/0eb90baf1b69
                                     
2011-01-07
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/0eb90baf1b69
                                     
2011-01-08



Hardware and Software, Engineered to Work Together