Greetings,

The following adjustments fix the intermittent issues with incomplete tag sets 
for a chunk. The situations are pretty subtle:

1. A situation can occur where an event is emitted during the event 
instrumentation callback as part of JVMTI Retransform (ErrorThrownEvent). A 
stack trace is captured that marks, or "tags", the existing method(s) of the 
klass (i.e. when the scratch class is instrumented). But after the 
instrumentation call returns, the set of methods of the klass is exchanged from 
the "old" methods (now marked) , to the new set of methods (from the scratch 
class, not marked). This means the mark/tag is lost for a method. Therefore, 
method tags must be transferred when exchanging methods during JVMTI redefine / 
retransform.
2. OldObjectSample events are emitted at the end of a recording. As part of 
writing the events, several checkpoint events are also created and enqueued. 
But these checkpoints are incomplete standalone because they need to be 
complemented with a typeset checkpoint, which happens just after, as part of 
the rotation. But flush() can occur concurrently with OldObjectSample emit, and 
can, therefore, serialize these checkpoints to a segment before the 
complementary typeset checkpoint has been created. There needs to be mutual 
exclusion between OldObjectSample emit() and flush(), now provided by the 
JfrRotationLock.
3. The set of artifacts captured during class unloading is incomplete because 
it respects already serialized artifacts. However, because class unloading 
typesets are linked to OldObjectSamples and DeprecationInvocation events, which 
survive chunk boundaries, those unloading typesets can be serialized in later 
chunks. If the unloading set is incomplete (not transitive), there will be 
missing constants. Hence, class unloading typesets require serialization of the 
entire transitive set of unloading artefacts, even if they have already been 
serialized to the current chunk.

As part of fixing these issues, the disabled assert is also reactivated.

Testing: jdk_jfr, stress testing, tier 1-6

Thanks
Markus

-------------

Commit messages:
 - revert jfrTraceIdMacros.hpp
 - revert jfrTraceId.cpp
 - cleared bits not needed on initialization
 - 8323883

Changes: https://git.openjdk.org/jdk/pull/17771/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17771&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8323883
  Stats: 167 lines in 15 files changed: 81 ins; 48 del; 38 mod
  Patch: https://git.openjdk.org/jdk/pull/17771.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17771/head:pull/17771

PR: https://git.openjdk.org/jdk/pull/17771

Reply via email to