On Fri, 9 Feb 2024 15:51:32 GMT, Erik Gahlin <egah...@openjdk.org> wrote:

>> 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 artefacts captured during class unloading is incomplete 
>> because it respects already serialized artefacts. However, because class 
>> unloading typesets are linked to OldObjectSamples and DeprecatedInvocation 
>> events, which survive chunk boundaries, these 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
>
> Nice work!
> 
> Let's hope this will be the last "missing object ID" bug to make it into 
> main-line.

Thanks @egahlin for the review.

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

PR Comment: https://git.openjdk.org/jdk/pull/17771#issuecomment-1943842563

Reply via email to