RFR: 8352251: Implement JEP 518: JFR Cooperative Sampling [v20]

Markus Grönlund mgronlun at openjdk.org
Tue May 13 20:27:54 UTC 2025


On Tue, 13 May 2025 09:32:29 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:

>> Markus Grönlund has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   tiny adjustments
>
> src/hotspot/share/jfr/periodic/sampling/jfrSampleRequest.cpp line 195:
> 
>> 193:     return false;
>> 194:   }
>> 195:   if (is_valid_interpreter_frame(request, jt)) {
> 
> I don't know how I feel about this kind of "quacks like an interpreter frame" check, if that's then used to 100% trust, as opposed to 99.999% guessed, that we have found a real parsable interpreter frame. If the quacking song sounds right, we can safely retrieve the Method* and fully trust it to have been an actual method that the interpreter is in the middle of executing, instead of just unexpected bit noise that was really really good at quacking like a valid interpreter frame. It might be more okay if the safe stack walk from the next safepoint poll validates that we found the same frame and it had the same method, and hence only choose to trust the bcp from the quacking sounds of the signal handler. If it's wrong, then we might get a confusing sample with an inaccurate bci. But that's better than a crash.
> 
> Regardless of the solution domain, I think this looks like a problem worth fixing.

Excellent observation, Erik. It remains a risky construct because it still assumes that frames are laid out only according to the sanctioned schema, a fact we know is not invariant. I have managed to delay reading the Method* until we reach a safe point, and can guarantee that any Method* we attempt to pick up is valid.

Running tests. Stay tuned.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24296#discussion_r2087576279


More information about the hotspot-jfr-dev mailing list