From 50849ab804502c1a7b975e14fa1d2fcb05feefed Mon Sep 17 00:00:00 2001 From: tajila Date: Mon, 18 Nov 2024 13:59:52 -0500 Subject: [PATCH 1/3] Release jfrSampler lock before acquiring VMaccess Signed-off-by: tajila --- runtime/vm/jfr.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/vm/jfr.cpp b/runtime/vm/jfr.cpp index 5bd5926093e..1cb13a7b72a 100644 --- a/runtime/vm/jfr.cpp +++ b/runtime/vm/jfr.cpp @@ -979,9 +979,11 @@ jfrSamplingThreadProc(void *entryArg) while (J9JFR_SAMPLER_STATE_STOP != vm->jfrSamplerState) { J9SignalAsyncEvent(vm, NULL, vm->jfrAsyncKey); if (0 == (count % 100)) { // 1 second + omrthread_monitor_exit(vm->jfrSamplerMutex); internalAcquireVMAccess(currentThread); jfrCPULoad(currentThread); internalReleaseVMAccess(currentThread); + omrthread_monitor_enter(vm->jfrSamplerMutex); if (0 == (count % 1000)) { // 10 seconds J9SignalAsyncEvent(vm, NULL, vm->jfrThreadCPULoadAsyncKey); } From e5a14a668e6ff7dcef0e9f9ddb4045fa3ed819e9 Mon Sep 17 00:00:00 2001 From: tajila Date: Mon, 18 Nov 2024 20:05:47 -0500 Subject: [PATCH 2/3] Disable JFR JCL APIs Disable JFR JCL APIs until JFR natives are implemented. Related to: https://github.com/eclipse-openj9/openj9/issues/20607 Signed-off-by: tajila --- jcl/src/java.base/share/classes/java/lang/System.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jcl/src/java.base/share/classes/java/lang/System.java b/jcl/src/java.base/share/classes/java/lang/System.java index 40ed484a719..411b7efa2f8 100644 --- a/jcl/src/java.base/share/classes/java/lang/System.java +++ b/jcl/src/java.base/share/classes/java/lang/System.java @@ -736,7 +736,10 @@ private static void ensureProperties(boolean isInitialization) { /*[ENDIF] CRIU_SUPPORT */ /*[IF JFR_SUPPORT]*/ + /* Enables openj9 JFR tests. */ initializedProperties.put("org.eclipse.openj9.jfr.isJFREnabled", "true"); //$NON-NLS-1$ //$NON-NLS-2$ + /* TODO disable JFR JCL APIs until JFR natives are implemented. */ + initializedProperties.put("jfr.unsupported.vm", "true"); //$NON-NLS-1$ //$NON-NLS-2$ /*[ENDIF] JFR_SUPPORT */ String[] list = getPropertyList(); From c4edde878904136e1c4b1e125d248b09f6974f20 Mon Sep 17 00:00:00 2001 From: Tobi Ajila Date: Tue, 19 Nov 2024 12:01:27 -0500 Subject: [PATCH 3/3] Fix potential cycle in JFR ThreadGroupEntry Related to https://github.com/eclipse-openj9/openj9/issues/20624 Signed-off-by: Tobi Ajila --- runtime/vm/JFRConstantPoolTypes.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/runtime/vm/JFRConstantPoolTypes.cpp b/runtime/vm/JFRConstantPoolTypes.cpp index beb757b8b7c..5d3f6090a8a 100644 --- a/runtime/vm/JFRConstantPoolTypes.cpp +++ b/runtime/vm/JFRConstantPoolTypes.cpp @@ -853,6 +853,15 @@ VM_JFRConstantPoolTypes::addThreadGroupEntry(j9object_t threadGroup) entry->parentIndex = addThreadGroupEntry(J9VMJAVALANGTHREADGROUP_PARENT(_currentThread, threadGroup)); if (isResultNotOKay()) goto done; + /* Check again to see if the Threadgroup was added recursively. */ + entry = (ThreadGroupEntry *) hashTableFind(_threadGroupTable, entry); + if (NULL != entry) { + index = entry->index; + goto done; + } else { + entry = &entryBuffer; + } + entry->name = copyStringToJ9UTF8WithMemAlloc(_currentThread, J9VMJAVALANGTHREADGROUP_NAME(_currentThread, threadGroup), J9_STR_NONE, "", 0, NULL, 0); entry->index = _threadGroupCount;