RFR: 8373485: JFR Crash during sampling: assert(jt->has_last_Java_frame()) failed: invariant

Markus Grönlund mgronlun at openjdk.org
Mon Jan 12 10:48:37 UTC 2026


On Mon, 12 Jan 2026 09:43:14 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Man, this is confusing. Looks to me thread states are guarded specially. Looking at `Handshake::execute`, I see the pattern is:
> 
> ```
>   // Separate the arming of the poll in add_operation() above from
>   // the read of JavaThread state in the try_process() call below.
>   if (UseSystemMemoryBarrier) {
>     SystemMemoryBarrier::emit();
>   } else {
>     OrderAccess::fence();
>   }
> ```
> 
> This follows `HandshakeState::add_operation` -> `SafepointMechanism::arm_local_poll_release`. `arm_local_poll_release` is what `JfrSampleThread::sample_native_thread` also does. So, the fix should follow what `Handshake` does. I think you are trying to do the same, but piggy-back on `OA::fence()` already done in `JfrMutexTryLock` when `-UseSystemMemoryBarrier`?

Exactly right.

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

PR Comment: https://git.openjdk.org/jdk/pull/29155#issuecomment-3737916202


More information about the hotspot-jfr-dev mailing list