RFR: 8285008: JFR: jdk/jfr/jmx/streaming/TestClose.java failed with "Exception: Expected repository to be empty"
Markus Grönlund
mgronlun at openjdk.java.net
Fri May 27 19:18:41 UTC 2022
On Fri, 27 May 2022 17:27:27 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:
> 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
Marked as reviewed by mgronlun (Reviewer).
-------------
PR: https://git.openjdk.java.net/jdk/pull/8927
More information about the hotspot-jfr-dev
mailing list