[jdk8u-dev] RFR: 8260589: Crash in JfrTraceIdLoadBarrier::load(_jclass*)

Long Yang duke at openjdk.java.net
Wed Apr 27 23:05:24 UTC 2022


Hi!

Please review the backport of JDK-8260589 to 8u.
This crash problem is easy to reproduce, so I feel it is necessary to backport it to 8u.

3 months ago, I launched webrev and it has been reviewed by Zhengyu Gu ([the review mail link](https://mail.openjdk.java.net/pipermail/jdk8u-dev/2022-March/014715.html)), thanks a lot to Zhengyu and Mario.
Recently, I learned that the review method of 8u was changed to github, so I re-launched it in the new way.

Bug: https://bugs.openjdk.java.net/browse/JDK-8260589
11u commit: https://github.com/openjdk/jdk11u-dev/commit/1d204c554ffe969567161cc05992486ff47d346d
Test: jdk/test/jdk/jfr/jvm/TestPrimitiveClasses.java passed.

Due to the differences between JFR in 11u and 17, Denghui made some changes when backporting this fix to 11u. 
Denghui's changes also apply to 8u, so I directly quote Denghui's list here. (4 in total)
1. use MaxJfrEventId + 101 instead of LAST_TYPE_ID + 1 as the klass id of void.class
2. jdk 11 doesn't support jfr streaming, so I removed the call `JfrTraceIdEpoch::set_changed_tag_state()` in `load_primitive`
3. the Class in jdk 11 doesn't have the field 'hidden', so I removed `writer->write<bool>(false);` in `write_primitive`
4. there are many differences in the API of JfrTraceId between 11u and tip

In addition to the above differences, I also make supplementary explanations for the modifications I made.
1. The static global variable clear_artifacts in 11u was introduced by the bugfix https://bugs.openjdk.java.net/browse/JDK-8231081, but this fix has not been backported to 8u, so I removed the code related to clear_artifacts. In 8u, the metadata of the primitive types will be written into the previous chunk on every chunk rotation.
2. In 11u, _artifacts and _class_unload are static global variables, but in 8u, they are static member variables of JfrTypeSet, so I also made necessary changes to the functions that use these two variables.

Thanks

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

Commit messages:
 - 8260589: Crash in JfrTraceIdLoadBarrier::load(_jclass*)

Changes: https://git.openjdk.java.net/jdk8u-dev/pull/36/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk8u-dev&pr=36&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8260589
  Stats: 230 lines in 6 files changed: 219 ins; 8 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk8u-dev/pull/36.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk8u-dev pull/36/head:pull/36

PR: https://git.openjdk.java.net/jdk8u-dev/pull/36


More information about the jdk8u-dev mailing list