> See the JBS issue for the extended problem description.
> 
> Native threads that were attached to the JVM through an FFM upcall are 
> automatically detached from the VM when they join/terminate. However, if a 
> native thread tries to terminate after the VM has exited without going 
> through `DestroyJavaVm` (e.g. as a result of calling `System.exit`), they 
> will block in `VM_Exit::block_if_vm_exited` inside `DetachCurrentThread`. 
> This may happen for instance when they try to join after the JVM has exited 
> in an `atexit` handler.
> 
> This patch adds a check before trying to detach the thread to see if the VM 
> has exited and bails out if it has. This does not prevent issues as a result 
> of a race between the VM exiting and the thread joining, but it does prevent 
> issues in the more comment case where a thread simply outlives the VM.
> 
> ---------
> - [X] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Jorn Vernee has updated the pull request incrementally with two additional 
commits since the last revision:

 - Cleanup imports
 - review comments

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/32686/files
  - new: https://git.openjdk.org/jdk/pull/32686/files/2791cf05..80c94a33

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=32686&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=32686&range=01-02

  Stats: 50 lines in 2 files changed: 8 ins; 19 del; 23 mod
  Patch: https://git.openjdk.org/jdk/pull/32686.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32686/head:pull/32686

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

Reply via email to