RFR: 8285008: JFR: jdk/jfr/jmx/streaming/TestClose.java failed with "Exception: Expected repository to be empty"

Erik Gahlin egahlin at openjdk.java.net
Fri May 27 17:42:24 UTC 2022


Could I have a review of a change that avoids a race condition.

Problem occurs if the main thread enters awaitTermination() after closed() has been called but before it has finished. If this happens, the main thread will not wait and instead proceed and check if files have been removed, potentially before this has actually happened. This can be reproduced by putting a Thread.sleep in the RecordingStream::close() method.

The solution is to check the terminated state instead of the closed state. This can be done using a CoundDownLatch in awaitTermination() which avoids much of the logic that is there today. 

I'm not sure it is the race that causes the test to fail. It could also be something related to deleting files on Windows, so I enabled logging to make it easier to diagnose. 

Testing: jdk/jdk/jfr

Thanks
Erik

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

Commit messages:
 - Merge branch 'openjdk:master' into remoteclose
 - Remove whitespaces
 - Initial

Changes: https://git.openjdk.java.net/jdk/pull/8927/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8927&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8285008
  Stats: 31 lines in 2 files changed: 2 ins; 20 del; 9 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8927.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8927/head:pull/8927

PR: https://git.openjdk.java.net/jdk/pull/8927


More information about the hotspot-jfr-dev mailing list