Skip to content

Commit

Permalink
Fix potential cycle in JFR ThreadGroupEntry
Browse files Browse the repository at this point in the history
Related to eclipse-openj9#20624

Signed-off-by: Tobi Ajila <[email protected]>
  • Loading branch information
tajila committed Nov 19, 2024
1 parent 44766de commit 2b3f3e1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions runtime/vm/JFRConstantPoolTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2b3f3e1

Please sign in to comment.