[jdk18] RFR: 8268297: jdk/jfr/api/consumer/streaming/TestLatestEvent.java times out
Markus Grönlund
mgronlun at openjdk.java.net
Thu Dec 23 14:32:17 UTC 2021
On Thu, 23 Dec 2021 04:51:46 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:
> Hi,
>
> Could I have a review of a fix that prevents a recording stream from dropping events/chunks.
>
> This occurs when rotation happens quickly, as in TestLatestEvent.java, and the clock is not making progress, on Windows sometimes. The result is a chunk header with duration 0 ns, meaning there could be two chunks with the same start timestamp, which confuses the RecordingStream when determining iteration order.
>
> The fix is to always increase the elapsed time by at least 1 ns. There were similar code prior to JDK 17, but it was removed because a mechanism was added in Java that makes sure a chunk always gets a unique Instant.now() timestamp. Unfortunately, that timestamp does not always correlate with what the JVM writes, which leads to intermittent failures in 2-4% of the time.
>
> I also updated the test, so it can provide better information in case of new failures.
>
> Testing:
> test/jdk/jdk/jfr/api/consumer/streaming/TestLatestEvent.java 600 times without failure on Windows
> test/jdk/jdk/jfr/ 6 times without failure on Mac, Linux and Windows.
>
> Thanks
> Erik
Looks good.
-------------
Marked as reviewed by mgronlun (Reviewer).
PR: https://git.openjdk.java.net/jdk18/pull/68
More information about the hotspot-jfr-dev
mailing list