Skip to content

Commit

Permalink
Add an unknown thread entry to JFR constant pool
Browse files Browse the repository at this point in the history
This fixes the error of "Size of check point event doesn't match
content" while reading a JFR chunk.

Signed-off-by: Gengchen Tuo <[email protected]>
  • Loading branch information
thallium committed Nov 26, 2024
1 parent fc778d6 commit 481d60e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions runtime/vm/JFRConstantPoolTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ J9_DECLARE_CONSTANT_UTF8(nativeMethod, "(nativeMethod)");
J9_DECLARE_CONSTANT_UTF8(nativeMethodSignature, "()");
J9_DECLARE_CONSTANT_UTF8(defaultPackage, "(defaultPackage)");
J9_DECLARE_CONSTANT_UTF8(bootLoaderName, "boostrapClassLoader");
J9_DECLARE_CONSTANT_UTF8(unknownThread, "unknown thread");

enum JFRStringConstants {
DefaultString = 0,
Expand Down Expand Up @@ -542,6 +543,21 @@ class VM_JFRConstantPoolTypes {
return value;
}

void addUnknownThreadEntry() {
ThreadEntry unknownThreadEntry = {0};
unknownThreadEntry.vmThread = NULL;
unknownThreadEntry.index = 0;
unknownThreadEntry.osTID = 0;
unknownThreadEntry.javaTID = 0;
unknownThreadEntry.javaThreadName = (J9UTF8 *)&unknownThread;
unknownThreadEntry.osThreadName = (J9UTF8 *)&unknownThread;
unknownThreadEntry.threadGroupIndex = 0;

ThreadEntry *entry = (ThreadEntry *)hashTableAdd(_threadTable, &unknownThreadEntry);
_firstThreadEntry = entry;
_previousThreadEntry = entry;
}

protected:

public:
Expand Down Expand Up @@ -1276,6 +1292,7 @@ class VM_JFRConstantPoolTypes {

/* Leave index 0 as a NULL entry for unknown notifier thread. */
_threadCount += 1;
addUnknownThreadEntry();

done:
return;
Expand Down

0 comments on commit 481d60e

Please sign in to comment.