RFR (S): 8218483: Crash in "assert(_daemon_threads_count->get_value() > daemon_count) failed: thread count mismatch 5 : 5"

David Holmes david.holmes at oracle.com
Mon Apr 1 22:30:55 UTC 2019


Bug: https://bugs.openjdk.java.net/browse/JDK-8218483
webrev: http://cr.openjdk.java.net/~dholmes/8218483/webrev/

A bug in Thread.setDaemon (JDK-8221657) means that the daemon state of a 
thread can change after the thread is !isAlive() at the Java level. If 
this happens before the VM call to ThreadService::remove_thread then we 
have a situation where we incremented the thread counters when the 
thread was not a daemon, and we decrement the thread counters when the 
thread is a daemon - and so the counters are out of sync and the 
assertion fires.

The simple fix is to capture the daemon state of the thread while it is 
still alive and to pass that through to Threads::remove and thus 
ThreadService::remove_thread.

Testing:
   - manual test with modified VM (to delay Threads::remove call) as per 
the bug report
   - mach 5 tiers 1-3

Thanks,
David



More information about the hotspot-runtime-dev mailing list