Integrated: 8374862: assert(false) failed: Attempting to acquire lock MDOExtraData_lock/nosafepoint-1 out of order with lock tty_lock/tty -- possible deadlock (running with -XX:+Verbose -XX:+WizardMode -XX:+PrintDeoptimizationDetails)

Guanqiang Han ghan at openjdk.org
Fri Jan 23 11:40:58 UTC 2026


On Tue, 13 Jan 2026 08:42:07 GMT, Guanqiang Han <ghan at openjdk.org> wrote:

> Please review this change. Thanks!
> 
> **Description:**
> 
> When -XX:+PrintDeoptimizationDetails is enabled, vframeArray.cpp prints interpreted frames under ttyLocker. 
> https://github.com/openjdk/jdk/blob/578204f8c49f06be8b9c4855359ca61c9e107678/src/hotspot/share/runtime/vframeArray.cpp#L493-L503
> In the WizardMode && Verbose branch it calls Method::print_codes() / print_codes_on(). The bytecode printing path may acquire MDOExtraData_lock (rank nosafepoint-1). 
> https://github.com/openjdk/jdk/blob/578204f8c49f06be8b9c4855359ca61c9e107678/src/hotspot/share/interpreter/bytecodeTracer.cpp#L597-L602
> Calling it while holding tty_lock violates the global lock ranking order and triggers a lock rank inversion assertion.
> 
> **Fix:**
> 
> Generate the bytecode dump before taking tty_lock, and print it afterwards under ttyLocker to keep the output coherent while preserving correct lock acquisition order. 
> To avoid double buffering when the target stream is already a thread-local stringStream, extend BytecodeTracer::print_method_codes with a buffered flag . The new call site uses buffered=false when dumping into the temporary stringStream.
> 
> **Test:** 
> 
> GHA

This pull request has now been integrated.

Changeset: 6f6966b2
Author:    Guanqiang Han <ghan at openjdk.org>
Committer: Dean Long <dlong at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/6f6966b28b2c5a18b001be49f5db429c667d7a8f
Stats:     71 lines in 6 files changed: 54 ins; 2 del; 15 mod

8374862: assert(false) failed: Attempting to acquire lock MDOExtraData_lock/nosafepoint-1 out of order with lock tty_lock/tty -- possible deadlock  (running with -XX:+Verbose -XX:+WizardMode  -XX:+PrintDeoptimizationDetails)

Reviewed-by: dholmes, dlong

-------------

PR: https://git.openjdk.org/jdk/pull/29186


More information about the hotspot-compiler-dev mailing list