On Mon, 8 Jun 2026 04:29:14 GMT, Arno Zeller <[email protected]> wrote:
>> test/jdk/javax/swing/SwingWorker/TestDoneBeforeDoInBackground.java line 126: >> >>> 124: }); >>> 125: worker.execute(); >>> 126: workerStarted.await(); >> >> I suppose it would be safer to call the `await` with a timeout. > > 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. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31348#discussion_r3374669950
