Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport "Enables parsing units for maxsize, fixes units for delay in JfrManager.java" #282

Merged
merged 2 commits into from
Aug 19, 2021

Conversation

zakkak
Copy link
Collaborator

@zakkak zakkak commented Aug 17, 2021

Backports oracle#3639

"Enables parsing units for maxsize, fixes units for delay in JfrManager.java"

Karm added 2 commits August 17, 2021 13:10
Fixes oracle#3638

Example:

Unpatched
---------

```
$ export JAVA_HOME=/home/karm/X/JDKs/graalvm-ce-java11-21.2.0/;export PATH=${JAVA_HOME}/bin:${PATH}

$ native-image --version
GraalVM 21.2.0 Java 11 CE (Java Version 11.0.12+6-jvmci-21.2-b08)

$ javac Main.java

$ native-image -H:+AllowVMInspection Main

$ java -XX:+FlightRecorder -XX:StartFlightRecording=maxsize=10M,filename=flight-java.jfr -Xlog:jfr Main
[0.279s][info][jfr] Flight Recorder initialized
[0.279s][info][jfr] Created repository /tmp/2021_07_30_15_11_00_295289
[0.309s][info][jfr] Creating thread sampler for java:20 ms, native 0 ms
[0.309s][info][jfr] Enrolling thread sampler
[0.309s][info][jfr] Enrolling thread sampler
[0.309s][info][jfr] Updated thread sampler for java: 20  ms, native 0 ms
[0.309s][info][jfr] Updated thread sampler for java: 20  ms, native 0 ms
[0.309s][info][jfr] Updated thread sampler for java: 20  ms, native 20 ms
[0.322s][info][jfr] Started recording "1" (1) {maxsize=10.0MB, dumponexit=true, filename=/tmp/rep/flight-java.jfr}
Started recording 1.
Use jcmd 295289 JFR.dump name=1 to copy recording data to file.
Meh.
[0.343s][info][jfr] Updated thread sampler for java: 0  ms, native 20 ms
[0.344s][info][jfr] Disenrolling thread sampler
[0.344s][info][jfr] Stopped recording "1" (1). Reason "Dump on exit".
[0.382s][info][jfr] Wrote recording "1" (1) to /tmp/rep/flight-java.jfr
[0.382s][info][jfr] Closed recording "1" (1)
[0.383s][info][jfr] Removed repository /tmp/2021_07_30_15_11_00_295289

$ ./main -XX:+FlightRecorder -XX:StartFlightRecording=maxsize=10M,filename=flight-native.jfr -XX:FlightRecorderLogging=jfr
Exception in thread "main" com.oracle.svm.core.util.UserError$UserException: Could not parse JFR argument 'maxsize=10M'. Expected a number.
    at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
    at com.oracle.svm.jfr.JfrManager.parseLong(JfrManager.java:171)
    at com.oracle.svm.jfr.JfrManager.initRecording(JfrManager.java:107)
    at com.oracle.svm.jfr.JfrManager.setup(JfrManager.java:72)
    at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:125)
    at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:75)
```

Patched
-------

```
$ export JAVA_HOME=/home/karm/tmp/mandrel-java11-21.3-SNAPSHOT/;export PATH=${JAVA_HOME}/bin:${PATH}

$ native-image --version
native-image 21.3.0-deveab4c4ec5cb5 Mandrel Distribution (Java Version 11.0.12+7)

$ native-image -H:+AllowVMInspection Main

$ ./main -XX:+FlightRecorder -XX:StartFlightRecording=maxsize=10M,filename=flight-native.jfr -XX:FlightRecorderLogging=jfr
[info][jfr] Flight Recorder initialized
[info][jfr] Created repository /tmp/2021_07_30_15_13_28_295949
[info][jfr] Started recording "1" (1) {maxsize=10.0MB, dumponexit=true, filename=/tmp/rep/flight-native.jfr}
Meh.
<removed for brevity>

$ ./main -XX:+FlightRecorder -XX:StartFlightRecording=maxsize=10m,filename=flight-native.jfr -XX:FlightRecorderLogging=jfr
[info][jfr] Flight Recorder initialized
[info][jfr] Created repository /tmp/2021_07_30_15_13_55_296117
[info][jfr] Started recording "1" (1) {maxsize=10.0MB, dumponexit=true, filename=/tmp/rep/flight-native.jfr}
Meh.
<removed for brevity>

$ ./main -XX:+FlightRecorder -XX:StartFlightRecording=maxsize=10k,filename=flight-native.jfr -XX:FlightRecorderLogging=jfr
[info][jfr] Flight Recorder initialized
[info][jfr] Created repository /tmp/2021_07_30_15_14_00_296178
[info][jfr] Started recording "1" (1) {maxsize=10.0kB, dumponexit=true, filename=/tmp/rep/flight-native.jfr}
Meh.
<removed for brevity>

$ ./main -XX:+FlightRecorder -XX:StartFlightRecording=maxsize=10K,filename=flight-native.jfr -XX:FlightRecorderLogging=jfr
[info][jfr] Flight Recorder initialized
[info][jfr] Created repository /tmp/2021_07_30_15_14_05_296238
[info][jfr] Started recording "1" (1) {maxsize=10.0kB, dumponexit=true, filename=/tmp/rep/flight-native.jfr}
Meh.
<removed for brevity>

$ ./main -XX:+FlightRecorder -XX:StartFlightRecording=maxsize=10g,filename=flight-native.jfr -XX:FlightRecorderLogging=jfr
[info][jfr] Flight Recorder initialized
[info][jfr] Created repository /tmp/2021_07_30_15_14_11_296302
[info][jfr] Started recording "1" (1) {maxsize=10.0GB, dumponexit=true, filename=/tmp/rep/flight-native.jfr}
Meh.
<removed for brevity>

$ ./main -XX:+FlightRecorder -XX:StartFlightRecording=maxsize=10G,filename=flight-native.jfr -XX:FlightRecorderLogging=jfr
[info][jfr] Flight Recorder initialized
[info][jfr] Created repository /tmp/2021_07_30_15_16_04_296529
[info][jfr] Started recording "1" (1) {maxsize=10.0GB, dumponexit=true, filename=/tmp/rep/flight-native.jfr}
Meh.
<removed for brevity>
```

Signed-off-by: Michal Karm Babacek <karm@redhat.com>
see:

```
java -XX:+FlightRecorder -XX:+FlightRecorder -XX:StartFlightRecording=maxsize=10000,maxage=10000m,delay=5f,filename=flight-native.jfr -Xlog:jfr  Main
java.lang.IllegalArgumentException: Integer parsing error nanotime value: illegal unit

whereas

java -XX:+FlightRecorder -XX:+FlightRecorder -XX:StartFlightRecording=maxsize=10000,maxage=10000m,delay=5d,filename=flight-native.jfr -Xlog:jfr  Main
[0.562s][info][jfr] Flight Recorder initialized
[0.562s][info][jfr] Created repository /tmp/2021_08_03_01_16_07_454665
[0.567s][info][jfr] Scheduled recording "1" (1) to start at 2021-08-08T01:16:07.684825
```

Signed-off-by: Michal Karm Babacek <karm@redhat.com>
@zakkak zakkak added this to the 21.2.0.1-Final milestone Aug 17, 2021
@zakkak zakkak requested a review from Karm August 17, 2021 10:13
@zakkak zakkak self-assigned this Aug 17, 2021
@zakkak zakkak changed the title Backport jfr fix2 Backport "Enables parsing units for maxsize, fixes units for delay in JfrManager.java" Aug 17, 2021
Copy link
Collaborator

@jerboaa jerboaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine. Thanks!

@zakkak zakkak merged commit f6bd1cd into graalvm:mandrel/21.2 Aug 19, 2021
@zakkak zakkak deleted the backport-jfr-fix2 branch August 19, 2021 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants