On Tue, 8 Sep 2026 09:55:35 GMT, Per Minborg <[email protected]> wrote:

>> Jorn Vernee has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Indentation
>>   
>>   Co-authored-by: David Holmes 
>> <[email protected]>
>
> test/jdk/java/foreign/detachafterexit/TestDetachAfterExit.java line 88:
> 
>> 86: 
>> 87:                 System.out.println("[main] Waiting for callback...");
>> 88:                 while (!flag.get()) {
> 
> `cb` sets `flag` in the callback, but the native worker may still be 
> executing I think. Can the `main` thread then close the arena (freeing the 
> upcall stub) and invoke `exit(0)` before the worker returns to native code? 
> If so, we could be exposed to use-after-free and/or leave the worker in an 
> unknown state. Is there a more robust way of handshaking or can we use a 
> timed delay here?

Good catch. Timed delays aren't reliable, so I'll use another flag to make sure 
the callback finishes executing first.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32686#discussion_r3958020035

Reply via email to