[jdk18] RFR: 8268297: jdk/jfr/api/consumer/streaming/TestLatestEvent.java times out
Erik Gahlin
egahlin at openjdk.java.net
Thu Dec 23 05:40:20 UTC 2021
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
-------------
Commit messages:
- Initial
Changes: https://git.openjdk.java.net/jdk18/pull/68/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk18&pr=68&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8268297
Stats: 24 lines in 3 files changed: 20 ins; 1 del; 3 mod
Patch: https://git.openjdk.java.net/jdk18/pull/68.diff
Fetch: git fetch https://git.openjdk.java.net/jdk18 pull/68/head:pull/68
PR: https://git.openjdk.java.net/jdk18/pull/68
More information about the hotspot-jfr-dev
mailing list