Integrated: 8285008: JFR: jdk/jfr/jmx/streaming/TestClose.java failed with "Exception: Expected repository to be empty"
Erik Gahlin
egahlin at openjdk.java.net
Sat May 28 17:25:29 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
This pull request has now been integrated.
Changeset: a6e2e223
Author: Erik Gahlin <egahlin at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/a6e2e223ea0339117c89f46e074a92dc2f31dfd5
Stats: 31 lines in 2 files changed: 2 ins; 20 del; 9 mod
8285008: JFR: jdk/jfr/jmx/streaming/TestClose.java failed with "Exception: Expected repository to be empty"
Reviewed-by: mgronlun
-------------
PR: https://git.openjdk.java.net/jdk/pull/8927
More information about the hotspot-jfr-dev
mailing list