> 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.

Chris Plummer has updated the pull request incrementally with one additional 
commit since the last revision:

  Suggestion from David. Widen synchronized block so it is not necessarry for 
notInterrupted to be atomic.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/14817/files
  - new: https://git.openjdk.org/jdk/pull/14817/files/41325e59..c2503883

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=14817&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14817&range=01-02

  Stats: 6 lines in 2 files changed: 1 ins; 1 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/14817.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14817/head:pull/14817

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

Reply via email to