Skip to content

Commit

Permalink
Merge pull request eclipse-openj9#20640 from tajila/jfr3
Browse files Browse the repository at this point in the history
Fix potential cycle in JFR ThreadGroupEntry
  • Loading branch information
gacholio authored Nov 20, 2024
2 parents e6ae080 + 2b3f3e1 commit b73365e
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 b73365e

Please sign in to comment.