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

ClassLoaderData::init_handle_locked adding ClassLoaderData oop misses record_modified_oops

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 11, 17, 18
    • Fix Version/s: None
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Intermittent crash might happen when stress GC with CDS. On OpenJDK11 this can be reproduced constantly, in JDK18 it reproduced in lower frequency.

      The reason is ClassLoaderData::init_handle_locked misses record_modified_oops when adding handle.

      void ClassLoaderData::init_handle_locked(OopHandle& dest, Handle h) {
        MutexLocker ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
        if (dest.resolve() != NULL) {
          return;
        } else {
          dest = _handles.add(h());
          // missing record_modified_oops();
        }
      }

      On jdk master
      make run-test CONF=fastdebug TEST="test/hotspot/jtreg/runtime/cds/BootAppendTests.java" JTREG="VM_OPTIONS=-XX:+UseG1GC -XX:+ScavengeALot -XX:ScavengeALotInterval=10 -XX:-GCALotAtAllSafepoints"

      # JRE version: OpenJDK Runtime Environment (18.0) (fastdebug build 18-internal+0-adhoc.shihui.jdk)
      # Java VM: OpenJDK 64-Bit Server VM (fastdebug 18-internal+0-adhoc.shihui.jdk, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0xbabae7] VerifyCLDClosure::do_cld(ClassLoaderData*)+0x77
      #
      # 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: -XX:MaxRAMPercentage=6.25 -Djava.io.tmpdir=/data/shihui/codes/shihui_jdk_master/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_runtime_cds_BootAppendTests_java/tmp -XX:+UseG1GC -XX:+ScavengeALot -XX:ScavengeALotInterval=10 -XX:-GCALotAtAllSafepoints -Xbootclasspath/a:/data/shihui/codes/shihui_jdk_master/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_runtime_cds_BootAppendTests_java/scratch/0/bootAppend.jar -Xshare:on -Dtest.timeout.factor=4.0 -XX:SharedArchiveFile=runtime.cds.BootAppendTests.java19h05m23s351.jsa -Xlog:class+load=info LoadClass javax.annotation.processing.FilerException

      Host: kalinshi, AMD EPYC 7K62 48-Core Processor, 8 cores, 15G, CentOS Linux release 7.2 (Final)
      Time: Wed Jul 7 19:05:30 2021 CST elapsed time: 2.041932 seconds (0d 0h 0m 2s)

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

      Current thread (0x00002b3294207b60): VMThread "VM Thread" [stack: 0x00002b32b2abb000,0x00002b32b2bbb000] [id=30804]

      Stack: [0x00002b32b2abb000,0x00002b32b2bbb000], sp=0x00002b32b2bb9720, free space=1017k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0xbabae7] VerifyCLDClosure::do_cld(ClassLoaderData*)+0x77
      V [libjvm.so+0x8cacca] ClassLoaderDataGraph::roots_cld_do(CLDClosure*, CLDClosure*)+0x4a
      V [libjvm.so+0xc00253] G1RootProcessor::process_all_roots(OopClosure*, CLDClosure*, CodeBlobClosure*)+0xa3
      V [libjvm.so+0xbaa268] G1HeapVerifier::verify(VerifyOption)+0x228
      V [libjvm.so+0x1834d0b] Universe::verify(VerifyOption, char const*)+0x28b
      V [libjvm.so+0x18ec3e7] VMThread::run()+0x167
      V [libjvm.so+0x17e80d8] Thread::call_run()+0xf8
      V [libjvm.so+0x13b0414] thread_native_entry(Thread*)+0x104

      on jdk11
      make run-test CONF=fastdebug TEST="test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java" JTREG="VM_OPTIONS=-XX:+UseG1GC -XX:+ScavengeALot -XX:ScavengeALotInterval=200 -XX:-GCALotAtAllSafepoints"

      Stack: [0x00002b62af73e000,0x00002b62af83e000], sp=0x00002b62af83c810, free space=1018k
      Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0xa252a7] oopDesc::size_given_klass(Klass*)+0x17
      V [libjvm.so+0xd4c612] G1ParScanThreadState::copy_to_survivor_space(InCSetState, oop, markOopDesc*)+0x42
      V [libjvm.so+0xd8ce5f] void G1ParCopyClosure<(G1Barrier)1, (G1Mark)0>::do_oop_work<oop>(oop*)+0x14f
      V [libjvm.so+0x9a7caa] ClassLoaderData::ChunkedHandleList::oops_do(OopClosure*)+0x5a
      V [libjvm.so+0xd45662] G1CLDScanClosure::do_cld(ClassLoaderData*)+0x52
      V [libjvm.so+0x9acafa] ClassLoaderDataGraph::roots_cld_do(CLDClosure*, CLDClosure*)+0x3a
      V [libjvm.so+0xd8e2a5] G1RootProcessor::process_java_roots(G1RootClosures*, G1GCPhaseTimes*, unsigned int)+0x65
      V [libjvm.so+0xd8eb38] G1RootProcessor::evacuate_roots(G1ParScanThreadState*, unsigned int)+0x68
      V [libjvm.so+0xcd6fd1] G1ParTask::work(unsigned int)+0xd1
      V [libjvm.so+0x1941970] GangWorker::loop()+0xe0
      V [libjvm.so+0x17ec145] Thread::call_run()+0x75
      V [libjvm.so+0x14fda86] thread_native_entry(Thread*)+0x106


      siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000fff80668c

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              hshi Hui Shi
              Reporter:
              hshi Hui Shi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: