A deep-dive investigation into a whole-VM lock-ordering deadlock in Android's ART runtime (Android 16, ART mainline v371000140+) triggered when attaching a Java debugger (JDWP) to large apps. The deadlock occurs between the garbage collector's system-weak processing phase and the JDWP commonRef monitor — a classic ABBA lock-ordering inversion that prevents the VM from reaching a safepoint, making standard Java stack dumps impossible. The author demonstrates how to diagnose such hangs using native ptrace thread dumps and per-thread kernel wait-state analysis (wchan) instead of Java dumps. The bug was reproduced on both Samsung Galaxy S22 hardware and a stock Google Play arm64 emulator, bisected to a specific ART mainline regression window (between versionCode 361143214 and 371000140), and filed publicly as Issue #530992434. Workarounds include pinning an older ART mainline version or isolating debug targets with smaller startup footprints.
Nguồn: https://proandroiddev.com/how-i-found-a-deadlock-inside-art-that-art-itself-couldnt-dump-ff7b33b0334a. 8sync News chỉ tóm tắt và dẫn link; bản quyền nội dung thuộc tác giả và nguồn gốc.