JDK-8326334 : JFR failed assert(used(klass)) failed: invariant
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jfr
  • Affected Version:
    8-pool-perf,17-pool-oracle,21-pool-oracle,23 8-pool-perf,17-pool-oracle,21-pool-oracle,23
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,windows
  • CPU: x86_64,aarch64
  • Submitted: 2024-02-20
  • Updated: 2024-10-01
  • Resolved: 2024-02-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23
23 b11Fixed
Related Reports
Relates :  
Description
The following test failed in the JDK23 CI:

applications/kitchensink/Kitchensink.java

Here's a snippet from the log file:

[2024-02-20T09:36:18.417501003Z] Gathering output for process 510147
[2024-02-20T09:36:24.605131798Z] Waiting for completion for process 510147
[2024-02-20T09:36:24.605629840Z] Waiting for completion finished for process 510147
[stress.process.out] #
[stress.process.out] # A fatal error has been detected by the Java Runtime Environment:
[stress.process.out] #
[stress.process.out] #  Internal Error (/opt/mach5/mesos/work_dir/slaves/0db9c48f-6638-40d0-9a4b-bd9cc7533eb8-S10327/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/0d23ab1b-4123-49eb-8a57-f696266070b5/runs/70d6a7bf-ff95-4aa8-9ff9-49930ccd580e/workspace/open/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp:357), pid=496330, tid=496339
[stress.process.out] #  assert(used(klass)) failed: invariant
[stress.process.out] #
[stress.process.out] # JRE version: Java(TM) SE Runtime Environment (23.0+11) (fastdebug build 23-ea+11-778)
[stress.process.out] # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 23-ea+11-778, mixed mode, sharing, tiered, compressed class ptrs, z gc, linux-aarch64)
[stress.process.out] # Problematic frame:
[stress.process.out] # V  [libjvm.so+0xe3d368]  write_klass(JfrCheckpointWriter*, Klass const*, bool, int&)+0xa44
[stress.process.out] #
[stress.process.out] # Core dump will be written. Default location: Core dumps may be processed with "/opt/core.sh %p" (or dumping to /opt/mach5/mesos/work_dir/slaves/412fde1c-3e26-4c3d-b41e-bab008e2c85d-S1173/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/baadb0cd-c42c-489e-8def-4f3c734e0667/runs/ffb8889b-a852-4031-a26a-4d191041416d/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_kitchensink_Kitchensink_java/scratch/0/core.496330)
[stress.process.out] #
[stress.process.out] # JFR recording file will be written. Location: /opt/mach5/mesos/work_dir/slaves/412fde1c-3e26-4c3d-b41e-bab008e2c85d-S1173/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/baadb0cd-c42c-489e-8def-4f3c734e0667/runs/ffb8889b-a852-4031-a26a-4d191041416d/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_kitchensink_Kitchensink_java/scratch/0/hs_err_pid496330.jfr
[stress.process.out] #
[stress.process.out] Unsupported internal testing APIs have been used.
[stress.process.out] 
[stress.process.out] # An error report file with more information is saved as:
[stress.process.out] # /opt/mach5/mesos/work_dir/slaves/412fde1c-3e26-4c3d-b41e-bab008e2c85d-S1173/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/baadb0cd-c42c-489e-8def-4f3c734e0667/runs/ffb8889b-a852-4031-a26a-4d191041416d/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_kitchensink_Kitchensink_java/scratch/0/hs_err_pid496330.log
[stress.process.out] [thread 510180 also had an error]
[stress.process.out] [thread 496412 also had an error]
[stress.process.out] [thread 510179 also had an error]
[stress.process.out] [thread 496437 also had an error]
[stress.process.out] [thread 496403 also had an error]
[stress.process.out] [thread 510305 also had an error]
[stress.process.out] 
[stress.process.out] ------ Timeout during error reporting after 120 s. ------
[2024-02-20T09:45:21.691772243Z] Gathering output for process 510353
[2024-02-20T09:45:22.043016724Z] Waiting for completion for process 510353
[2024-02-20T09:45:22.043173965Z] Waiting for completion finished for process 510353


Here's the crashing thread's stack:

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

Current thread (0x0000ffff7c0a1b90):  ConcurrentGCThread "XDriver"  [id=496339, stack(0x0000ffff81127000,0x0000ffff81325000) (2040K)]

Stack: [0x0000ffff81127000,0x0000ffff81325000],  sp=0x0000ffff81323270,  free space=2032k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xe3d368]  write_klass(JfrCheckpointWriter*, Klass const*, bool, int&)+0xa44  (jfrTypeSet.cpp:357)
V  [libjvm.so+0xe42b90]  JfrArtifactCallbackHost<Klass const*, CompositeFunctor<Klass const*, JfrTypeWriterHost<JfrPredicatedTypeWriterImplHost<Klass const*, SerializePredicate<Klass const*>, &(write__klass(JfrCheckpointWriter*, void const*))>, 183u>, KlassArtifactRegistrator> >::do_artifact(void const*)+0x60  (jfrTypeSet.cpp:396)
V  [libjvm.so+0x86f338]  ClassLoaderData::classes_do(void (*)(Klass*))+0x34  (classLoaderData.cpp:395)
V  [libjvm.so+0x887a64]  ClassUnloadingContext::classes_unloading_do(void (*)(Klass*))+0x84  (classUnloadingContext.cpp:92)
V  [libjvm.so+0xe4204c]  JfrTypeSet::serialize(JfrCheckpointWriter*, JfrCheckpointWriter*, bool, bool)+0xef8  (jfrTypeSet.cpp:554)
V  [libjvm.so+0xd8761c]  JfrCheckpointManager::on_unloading_classes()+0x6c  (jfrCheckpointManager.cpp:628)
V  [libjvm.so+0x1578c54]  SystemDictionary::do_unloading(GCTimer*)+0x3e4  (systemDictionary.cpp:1551)
V  [libjvm.so+0x17604e0]  XUnload::unlink()+0xb0  (xUnload.cpp:148)
V  [libjvm.so+0x170cd64]  XHeap::process_non_strong_references()+0x54  (xHeap.cpp:329)
V  [libjvm.so+0x1707fbc]  XDriver::concurrent_process_non_strong_references()+0x98  (xDriver.cpp:315)
V  [libjvm.so+0x17092a4]  XDriver::gc(XDriverRequest const&)+0x884  (xDriver.cpp:463)
V  [libjvm.so+0x1709d48]  XDriver::run_service()+0x114  (xDriver.cpp:493)
V  [libjvm.so+0x91d5c4]  ConcurrentGCThread::run()+0x24  (concurrentGCThread.cpp:48)
V  [libjvm.so+0x15b9e70]  Thread::call_run()+0xac  (thread.cpp:221)
V  [libjvm.so+0x132aabc]  thread_native_entry(Thread*)+0x12c  (os_linux.cpp:816)
C  [libpthread.so.0+0x7928]  start_thread+0x188
Comments
Changeset: 23522682 Author: Markus Grönlund <mgronlun@openjdk.org> Date: 2024-02-21 13:38:36 +0000 URL: https://git.openjdk.org/jdk/commit/23522682d4bcf9592682007909a74c5cf0b067c3
21-02-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/17934 Date: 2024-02-20 18:58:19 +0000
20-02-2024

The interaction problem concerning ZGC concurrent class unloading and the JFR Thread Sampler is also fixed by this. Please see JDK-8321822. JDK-8321822 will be fixed by a different solution, but this is relevant for potential backports.
20-02-2024