RFR: 8016074 NMT: assertion failed: assert(thread->thread_state() == from) failed: coming from wrong thread state

Zhengyu Gu zhengyu.gu at oracle.com
Wed Jul 3 04:32:05 PDT 2013


Solaris os::yield_all() implementation depends on os::sleep(), which requires JavaThread to be in _thread_in_vm state. As NMT tracking call can originate from any thread in any state, transits to _thread_in_vm can be dangerous, if caller holds any locks, deadlock or lock out of order can result, since state transition code may block on Threads_lock.

The solution is to use os::NakedYield() which calls to system thr_yield().

On Linux and BSD, os::yield_all() and os::NakedYield() implementations are the same.

On Windows, the implementations are different, based on our QA feedback, os::NakedYield() does not perform as well as os::yield_all().


External bug:http://bugs.sun.com/view_bug.do?bug_id=8016074
JBS:https://jbs.oracle.com/bugs/browse/JDK-8016074
Webrev:http://cr.openjdk.java.net/~zgu/8016074/webrev.00/


Tests:
   - JPRT with -XX:-AutoShutdownNMT flag
   - Kitchensink on Solaris 11, with -XX:NativeMemoryTracking=detail -XX:-AutoShutdownNMT -XX:+SafepointALot
     over 12 hours now.


Thanks,

-Zhengyu



More information about the hotspot-runtime-dev mailing list