-
Bug
-
Resolution: Fixed
-
P4
-
14, 15
-
b16
Both JMC and the JFR parser reports that some events from non-java threads have a 'null' eventThread.
I found that the following code fails to checkpoint the non-java threads:
void JfrThreadConstantSet::serialize(JfrCheckpointWriter& writer) {
JfrCheckpointThreadClosure tc(writer);
...
JfrNonJavaThreadIterator nonjavathreads;
while (nonjavathreads.has_next()) {
tc.do_thread(nonjavathreads.next());
}
}
because the following code only returns the last thread:
---
static NonJavaThread* next_non_java_thread(NonJavaThread::Iterator& iter) {
NonJavaThread* next = NULL;
while (!iter.end()) {
next = iter.current();
iter.step();
assert(next != NULL, "invariant");
if (!thread_inclusion_predicate(next)) {
continue;
}
}
return next;
}
---
I've tested with the following code, and then we get the correct thread names:
---
static NonJavaThread* next_non_java_thread(NonJavaThread::Iterator& iter) {
while (!iter.end()) {
NonJavaThread* next = iter.current();
iter.step();
assert(next != NULL, "invariant");
if (thread_inclusion_predicate(next)) {
return next;
}
}
return NULL;
}
---
I found that the following code fails to checkpoint the non-java threads:
void JfrThreadConstantSet::serialize(JfrCheckpointWriter& writer) {
JfrCheckpointThreadClosure tc(writer);
...
JfrNonJavaThreadIterator nonjavathreads;
while (nonjavathreads.has_next()) {
tc.do_thread(nonjavathreads.next());
}
}
because the following code only returns the last thread:
---
static NonJavaThread* next_non_java_thread(NonJavaThread::Iterator& iter) {
NonJavaThread* next = NULL;
while (!iter.end()) {
next = iter.current();
iter.step();
assert(next != NULL, "invariant");
if (!thread_inclusion_predicate(next)) {
continue;
}
}
return next;
}
---
I've tested with the following code, and then we get the correct thread names:
---
static NonJavaThread* next_non_java_thread(NonJavaThread::Iterator& iter) {
while (!iter.end()) {
NonJavaThread* next = iter.current();
iter.step();
assert(next != NULL, "invariant");
if (thread_inclusion_predicate(next)) {
return next;
}
}
return NULL;
}
---