On Mon, 10 Jul 2023 20:17:21 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:

> After [JDK-8308232](https://bugs.openjdk.org/browse/JDK-8308232), both the 
> test and the debuggee shared the same waittime of 5 minutes. The test would 
> wait up to 5 minutes for the expected prompt, but the debuggee would also in 
> some cases wait 5 minutes before generating the prompt, which sometimes was 
> just a bit too late. Before 
> [JDK-8308232](https://bugs.openjdk.org/browse/JDK-8308232), the debuggee 
> would wait at most 2 minutes before generating the prompt, so it was always 
> generated in time.
> 
> The main issue is that after the while loop checks that there are still 
> uninterrupted threads remaining, the last of the threads is interrupted 
> before the wait() call is made. This means wait() won't return until it times 
> out, and by then it is too late, and the test side has already timed out 
> waiting for the prompt.
> 
> The fix is to widen the synchronized block so the count of not interrupted 
> threads remains correct until `wait()` is entered. The other choice was to 
> refetch the count after entering the synchronized block, which is what I did 
> for the initial fix, but widening seems a better choice so no refetch is 
> needed.
> 
> For details see 
> https://bugs.openjdk.org/browse/JDK-8310551?focusedCommentId=14594838&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14594838
> 
> Tested with 300 runs each on linux-x64 and linux-aarch64 with -Xcomp options 
> that reproduced the issue, and then again with no options.

This pull request has now been integrated.

Changeset: c84866ac
Author:    Chris Plummer <cjplum...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/c84866ac0dcda487fe2abc2a8841f237df0a395b
Stats:     10 lines in 3 files changed: 1 ins; 3 del; 6 mod

8310551: vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001.java timed out 
due to missing prompt

Reviewed-by: kevinw, sspitsyn

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

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

Reply via email to