On Mon, 8 Jun 2026 16:05:51 GMT, Alexander Zvegintsev <[email protected]> 
wrote:

>> I must admit that I don't quite understand why this would be safer. My 
>> assumption is that if the latch is never counted down, something has already 
>> gone seriously wrong, and we would end up hitting the jtreg timeout 
>> regardless. But I may be missing some aspect of the reasoning here.
>
> Yes, if the latch is never counted down, then something is already wrong, but 
> my concern is with the failure mode:
> 
> An unbounded `await` causes the test to hang, relying on the global jtreg 
> timeout for diagnosis. When run outside of jtreg directly(`java 
> test/jdk/javax/swing/SwingWorker/TestDoneBeforeDoInBackground.java`), the 
> test simply hangs indefinitely.
> 
> A bounded `await` would fail at the specific point of failure with a clear 
> message (e.g., "worker did not start in time"). This also ensures consistency 
> with the existing bounded `await` for `doneLatch`.
> 
> Overall, this approach is easier to triage, faster in CI, and more robust 
> when running tests under different timeout configurations.

Thanks a lot for the explanation - I understand now and fully agree. I added a 
timeout with a failure message using a timeout value that is slightly higher 
than it was before and adjusted by the timeout factor of jtreg.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31348#discussion_r3380477546

Reply via email to