On Wed, 25 Nov 2026 13:54:17 GMT, Alan Bateman <[email protected]> wrote:

>> test/jdk/com/sun/management/HotSpotDiagnosticMXBean/DumpThreads.java line 
>> 681:
>> 
>>> 679:             try (var scope = StructuredTaskScope.open()) {
>>> 680:                 queue.put(scope);
>>> 681:                 scope.fork(() -> LockSupport.park());
>> 
>> Q: Is it reliable enough to use `LockSupport.park()` at 681? Can it return 
>> spuriously? Same applies to the line 765.
>
> This is forking a virtual thread and I can't think of any cases where the 
> parking permit would be set (causing the thread to not park). There are 20+ 
> other tests for virtual threads that do the same so if we had an issue then 
> there would be failures elsewhere too.

Okay, thanks. I kind of expected this answer. Just wanted to ensure.

>> test/jdk/com/sun/management/HotSpotDiagnosticMXBean/DumpThreads.java line 
>> 687:
>> 
>>> 685:             } catch (Throwable e) {
>>> 686:                 fail(e);
>>> 687:             }
>> 
>> Q: Are the exception thrown at lines 633 and 686 propagated to the JUnit 
>> test thread?
>
> If join were to throw, without waiting for the target thread then 
> awaitWaiting would assert. We could capture the exception but maybe simpler 
> to just print the stack trace in joinerThread, it will be in the logs when 
> the main asserts (and causes the test to fail).

Okay, thanks.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33659#discussion_r4696486918
PR Review Comment: https://git.openjdk.org/jdk/pull/33659#discussion_r4696505779

Reply via email to