[jdk21u-dev] RFR: 8327799: JFR view: the "Park Until" field of jdk.ThreadPark is invalid if the parking method is not absolute

Long Yang lyang at openjdk.org
Fri Mar 15 02:31:06 UTC 2024


Hi, all

Could I have a review of this backport ? I would be very grateful.

This pull request contains a backport of commit [6f8b0a33fa15f1dfc8b0c116375df0f90d9d8759](https://github.com/openjdk/jdk/commit/6f8b0a33fa15f1dfc8b0c116375df0f90d9d8759) from the [openjdk/jdk](https://github.com/openjdk/jdk) repository.

This backport is clean.


UNSAFE.park(true, System.currentTimeMillis() + 1000);
UNSAFE.park(false, 2000L * 1000 * 1000);


``` bash
jfr view jdk.ThreadPark test.jfr
                                                    Java Thread Park

Start Time Duration Event Thread Stack Trace             Class Parked On Park Timeout Park Until Address of Object Pa...
---------- -------- ------------ ----------------------- --------------- ------------ ---------- -----------------------
20:11:10     1.00 s main         jdk.internal.misc.Un... N/A                      N/A 20:11:11   0x00000000
20:11:11     1.00 s main         jdk.internal.misc.Un... N/A                   1.00 s 08:05:43   0x00000000



If the parking method is not absolute (the second line of the Java code above), the real value of `until` field in JFR's `jdk.ThreadPark` event is `Long.MIN_VALUE`, which will be convert back to `java.time.Instant.MIN`, but `jfr view` displays this value as '08:05:43' of my timezone (the `Park Until` column above).  This is somewhat misleading, better to show `N/A`.

Testing: 
test/jdk/jdk/jfr/tool/TestView.java
test/jdk/jdk/jfr/jcmd/TestJcmdView.java

All passed.

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

Commit messages:
 - 8327799: JFR view: the "Park Until" field of jdk.ThreadPark is invalid if the parking method is not absolute

Changes: https://git.openjdk.org/jdk21u-dev/pull/366/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk21u-dev&pr=366&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8327799
  Stats: 3 lines in 1 file changed: 3 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk21u-dev/pull/366.diff
  Fetch: git fetch https://git.openjdk.org/jdk21u-dev.git pull/366/head:pull/366

PR: https://git.openjdk.org/jdk21u-dev/pull/366


More information about the jdk-updates-dev mailing list