On Thu, 24 Jul 2025 12:49:36 GMT, Markus Grönlund <mgron...@openjdk.org> wrote:

> Greetings,
> 
> The following change set addresses the data loss resulting in the assertion 
> "Missing object ID X in pool jdk.types.Method".
> 
> It involves three components:
> 
> 1. Address a regression introduced by 
> [JDK-835221](https://bugs.openjdk.org/browse/JDK-8352251). By locating 
> JFR_ONLY(Jfr::check_and_process_sample_request(thread);) before the 
> global_poll() in SafepointMechanism::process(), a stacktrace can be captured, 
> and artifacts tagged, during a safepoint. This breaks an invariant as 
> artifacts, i.e. methods, can be tagged in the wrong epoch (also a stacktrace 
> can be stored in the wrong epoch). Must be moved to post global_poll().
> 
> 2. Retransform/Redefine classes include a non-safe copy of Method trace 
> flags, leading to stale bits being set onto the new Methods. Method trace 
> flags need to be copied, but must be done under a safepoint.
> 
> 3. It seems that there has been an increase in the frequency of issuing calls 
> to InstanceKlass::purge_previous_versions(), making scratch klasses and old 
> methods disappear before JFR gets the chance to serialize also tagged old 
> methods. Therefore, we need to ensure that we always tag the latest version 
> of a Method.
> 
> There is also a cleanup of gratuitous type conversions, from Klass* to 
> InstanceKlass* in the newly introduced MethodTracing subsystem.
> 
> Testing: jdk_jfr, stress testing
> 
> Thank you
> Markus

This pull request has now been integrated.

Changeset: a3499447
Author:    Markus Grönlund <mgron...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/a34994476e8f4783c9f5a83a9c3db63ad605b323
Stats:     303 lines in 24 files changed: 129 ins; 101 del; 73 mod

8356587: Missing object ID X in pool jdk.types.Method

Reviewed-by: egahlin

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

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

Reply via email to