On Thu, 23 Apr 2026 19:08:26 GMT, Patricio Chilano Mateo 
<[email protected]> wrote:

> Please review the following small fix. When trying to get the snapshot of a 
> platform thread, we can find the `JavaThread` in the created 
> `ThreadsListHandle`, but before executing the 
> `GetThreadSnapshotHandshakeClosure` the target might have already set its 
> `_terminated` field to `_thread_terminated`. In that case the 
> `Handshake::execute` call will return without the closure being executed. 
> Since `cl._thread_status` is initialized to `JavaThreadStatus::NEW` we hit 
> the next assert in the code.
> 
> The proposed fix is to initialize `cl._thread_status` to 
> `JavaThreadStatus::TERMINATED` instead.
> 
> I added new test `ThreadExiting.java` which reliably reproduces the issue.
> 
> Thanks,
> Patricio
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: edff559c
Author:    Patricio Chilano Mateo <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/edff559cef5f21a61de5054cb91f1817d5c23e12
Stats:     128 lines in 5 files changed: 77 ins; 39 del; 12 mod

8379968: Test crashed:  assert(cl._thread_status != JavaThreadStatus::NEW) 
failed: unstarted Thread

Reviewed-by: dholmes, alanb

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

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

Reply via email to