[jdk18] Integrated: 8268297: jdk/jfr/api/consumer/streaming/TestLatestEvent.java times out

Erik Gahlin egahlin at openjdk.java.net
Thu Dec 23 15:06:18 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

This pull request has now been integrated.

Changeset: 730f6708
Author:    Erik Gahlin <egahlin at openjdk.org>
URL:       https://git.openjdk.java.net/jdk18/commit/730f67081dcda37df7fc40eda99ebd39028be15f
Stats:     24 lines in 3 files changed: 20 ins; 1 del; 3 mod

8268297: jdk/jfr/api/consumer/streaming/TestLatestEvent.java times out

Reviewed-by: mgronlun

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

PR: https://git.openjdk.java.net/jdk18/pull/68


More information about the hotspot-jfr-dev mailing list