Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8328987

GenShen: Enforce that worker threads and vm thread are in SuspendibleThreadState when accessing object headers

XMLWordPrintable

    • gc

      Recent crashes have demonstrated that we do not consistently adhere to expected protocols:

      For example:
      ```
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/home/kdnilsen/gitfarm/experiment/src/hotspot/share/oops/markWord.cpp:38), pid=9264, tid=9276
      # assert(!UseShenandoahGC || validate_shenandoah_displaced_mark_helper(current)) failed: ShenandoahGCWorker Thread (VM Thread) must be suspendible: is_VM_thread: yes, is_at_safepoint: no, is_suspendible: no, is_shenandoah_suspendible: no
      #
      # JRE version: OpenJDK Runtime Environment (17.0.11) (fastdebug build 17.0.11-internal+0-adhoc.kdnilsen.experiment)
      # Java VM: OpenJDK 64-Bit Server VM (fastdebug 17.0.11-internal+0-adhoc.kdnilsen.experiment, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, shenandoah gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x14ab255] markWord::displaced_mark_helper() const+0x215
      #
      # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
      #
      # If you would like to submit a bug report, please visit:
      # https://bugreport.java.com/bugreport/crash.jsp
      #

      --------------- S U M M A R Y ------------

      Command Line: -Dtest.vm.opts=-XX:MaxRAMPercentage=3.125 -Djava.io.tmpdir=/home/kdnilsen/gitfarm/experiment/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_hotspot_gc/tmp -Dtest.tool.vm.opts=-J-XX:MaxRAMPercentage=3.125 -J-Djava.io.tmpdir=/home/kdnilsen/gitfarm/experiment/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_hotspot_gc/tmp -Dtest.compiler.opts= -Dtest.java.opts= -Dtest.jdk=/home/kdnilsen/gitfarm/experiment/build/linux-x86_64-server-fastdebug/images/jdk -Dcompile.jdk=/home/kdnilsen/gitfarm/experiment/build/linux-x86_64-server-fastdebug/images/jdk -Dtest.timeout.factor=4.0 -Dtest.nativepath=/home/kdnilsen/gitfarm/experiment/build/linux-x86_64-server-fastdebug/images/test/hotspot/jtreg/native -Dtest.root=/local/home/kdnilsen/gitfarm/experiment/test/hotspot/jtreg -Dtest.name=gc/shenandoah/TestJcmdHeapDump.java#generational -Dtest.file=/local/home/kdnilsen/gitfarm/experiment/test/hotspot/jtreg/gc/shenandoah/TestJcmdHeapDump.java -Dtest.src=/local/home/kdnilsen/gitfarm/experiment/test/hotspot/jtreg/gc/shenandoah -Dtest.src.path=/local/home/kdnilsen/gitfarm/experiment/test/hotspot/jtreg/gc/shenandoah:/local/home/kdnilsen/gitfarm/experiment/test/lib -Dtest.classes=/local/home/k\
      dnilsen/gitfarm/experiment/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_hotspot_gc/classes/3/gc/shenandoah/TestJcmdHeapDump_generational.d -Dtest.class.path=/local/home/kdnilsen/gitfarm/experiment/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_hotspot_gc/classes/3/gc/shenandoah/TestJcmdHeapDump_generational.d:/local/home/kdnilsen/gitfarm/experiment/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_hotspot_gc/classes/3/test/lib -Dtest.class.path.prefix=/local/home/kdnilsen/gitfarm/experiment/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_hotspot_gc/classes/3/gc/shenandoah/TestJcmdHeapDump_generational.d:/local/home/kdnilsen/gitfarm/experiment/test/hotspot/jtreg/gc/shenandoah:/local/home/kdnilsen/gitfarm/experiment/build/linux-x86_64-server-fastdebug/test-support/jt\
      reg_test_hotspot_jtreg_hotspot_gc/classes/3/test/lib -Dtest.modules=jdk.attach/com.sun.tools.attach --add-modules=jdk.attach --add-exports=jdk.attach/com.sun.tools.attach=ALL-UNNAMED -XX:MaxRAMPercentage=3.125 -Djava.io.tmpdir=/home/kdnilsen/gitfarm/experiment/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_hotspot_gc/tmp -Djava.library.path=/home/kdnilsen/gi\
      tfarm/experiment/build/linux-x86_64-server-fastdebug/images/test/hotspot/jtreg/native -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive -XX:ShenandoahGCMode=generational -Dtarget=10000 com.sun.javatest.regtest.agent.MainWrapper /local/home/kdnilsen/gitfarm/experiment/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_hotspot_gc/gc/shenandoah/TestJcmdHeapDump_generational.d/main.0.jta

      Host: dev-dsk-kdnilsen-2a-f67b72e0.us-west-2.amazon.com, Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz, 16 cores, 62G, Amazon Linux release 2 (Karoo)
      Time: Sun Mar 24 19:53:29 2024 UTC elapsed time: 1.181980 seconds (0d 0h 0m 1s)

      --------------- T H R E A D ---------------

      Current thread (0x00007fa74c19e6c0): VMThread "VM Thread" [stack: 0x00007fa6dae31000,0x00007fa6daf31000] [id=9276]

      Stack: [0x00007fa6dae31000,0x00007fa6daf31000], sp=0x00007fa6daf2f410, free space=1017k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x14ab255] markWord::displaced_mark_helper() const+0x215
      V [libjvm.so+0x6e5c5b] oopDesc::klass() const+0x18b
      V [libjvm.so+0xe3ae92] DumperSupport::mask_dormant_archived_object(oop)+0x22
      V [libjvm.so+0xe33677] DumperSupport::dump_field_value(DumpWriter*, char, oop, int)+0x2f7
      V [libjvm.so+0xe3599d] DumperSupport::dump_class_and_array_classes(DumpWriter*, Klass*)+0x55d
      V [libjvm.so+0x9f552d] ClassLoaderData::classes_do(KlassClosure*)+0x3d
      V [libjvm.so+0x9ff31d] ClassLoaderDataGraph::classes_do(KlassClosure*)+0x1bd
      V [libjvm.so+0xe32b9f] VM_HeapDumper::work(unsigned int) [clone .part.0]+0xdf
      V [libjvm.so+0x1d4f180] WorkGang::run_task(AbstractGangTask*, unsigned int, bool)+0x140
      V [libjvm.so+0xe33049] VM_HeapDumper::doit()+0xf9
      V [libjvm.so+0x1ce3b4a] VM_Operation::evaluate()+0x18a
      V [libjvm.so+0x1d0826e] VMThread::evaluate_operation(VM_Operation*)+0x17e
      V [libjvm.so+0x1d08f9c] VMThread::inner_execute(VM_Operation*)+0x20c
      V [libjvm.so+0x1d091e5] VMThread::loop()+0xb5
      V [libjvm.so+0x1d09317] VMThread::run()+0xc7
      V [libjvm.so+0x1be6a10] Thread::call_run()+0x100
      V [libjvm.so+0x165e020] thread_native_entry(Thread*)+0x110
      ```
      Another violation has been observed with GC worker threads:
      ```
      # Internal Error (/home/kdnilsen/gitfarm/experiment/src/hotspot/share/oops/markWord.cpp:38), pid=24379, tid=24518
      # assert(!UseShenandoahGC || validate_shenandoah_displaced_mark_helper(current)) failed: ShenandoahGCWorker Thread (Shenandoah GC Threads#4) must be suspendible: is_Java_thread: no, is_at_safepoint: no, is_suspendible: no, is_shenandoah_suspendible: no

      Stack: [0x00007f32f1ef8000,0x00007f32f1ff8000], sp=0x00007f32f1ff69a0, free space=1018k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x14ab25b] markWord::displaced_mark_helper() const+0x21b
      V [libjvm.so+0x182ee86] ShenandoahAsserts::assert_correct(void*, oop, char const*, int)+0xb86
      V [libjvm.so+0x183029d] ShenandoahAsserts::assert_not_forwarded(void*, oop, char const*, int)+0x4d
      V [libjvm.so+0x1885406] void ShenandoahMark::mark_through_ref<oop, (ShenandoahGenerationType)2>(oop*, Padded<BufferedOverflowTaskQueue<ShenandoahMarkTask, (MEMFLAGS)5, 131072u>, 128ul>*, Padded<BufferedOverflowTaskQueue<ShenandoahMarkTask, (MEMFLAGS)5, 131072u>, 128ul>*, ShenandoahMarkingContext*, bool)+0xc6
      V [libjvm.so+0x1a00a36] void OopStorageSetStrongParState<true, false>::oops_do<OopClosure>(OopClosure*)+0xd6
      V [libjvm.so+0x19ff8d6] ShenandoahConcurrentRootScanner::roots_do(OopClosure*, unsigned int)+0xa6
      V [libjvm.so+0x187e31d] ShenandoahMarkConcurrentRootsTask<(ShenandoahGenerationType)2>::work(unsigned int)+0xbd
      V [libjvm.so+0x1d4f745] GangWorker::run_task(WorkData)+0x85
      V [libjvm.so+0x1d4f884] GangWorker::loop()+0x44
      V [libjvm.so+0x1d4f8da]
      V [libjvm.so+0x1be6980] Thread::call_run()+0x100
      V [libjvm.so+0x165e000] thread_native_entry(Thread*)+0x110
      ```

            kdnilsen Kelvin Nilsen
            kdnilsen Kelvin Nilsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: