-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
25
-
None
Running the xctracenorm profiler on benchmarks generated in the JDK project fails with "Cannot invoke "java.io.InputStream.read(byte[])" because "fis" is null" error:
```
Running tests using MICRO control variable 'OPTIONS=-p probability=100 -jvmArgs -XX:-UseSuperWord -prof xctracenorm -v EXTRA;FORK=1'
Test selection 'micro:org.openjdk.bench.java.lang.MinMaxVector.longReductionMultiplyMax', will run:
* micro:org.openjdk.bench.java.lang.MinMaxVector.longReductionMultiplyMax
Running test 'micro:org.openjdk.bench.java.lang.MinMaxVector.longReductionMultiplyMax'
Profilers failed to initialize, exiting.
java.lang.reflect.InvocationTargetException
null
Cannot invoke "java.io.InputStream.read(byte[])" because "fis" is null
```
The issue happens because the benchmarks.jar that JDK build generates does not include `default.instruments.template.xml` resource that the JMH core jar includes:
```
$ jar tf jdk/build/release-darwin-arm64/images/test/micro/benchmarks.jar | grep default.instruments
<not output>
```
A benchmarks.jar generated in a Maven JMH project does include it:
```
$ ~/opt/boot-java-24/bin/jar tf benchmarks.jar | grep default
default.instruments.template.xml
```
A workaround that might work would be to pass in the `template` parameter to the profiler and point to the xml somewhere in the system.
```
Running tests using MICRO control variable 'OPTIONS=-p probability=100 -jvmArgs -XX:-UseSuperWord -prof xctracenorm -v EXTRA;FORK=1'
Test selection 'micro:org.openjdk.bench.java.lang.MinMaxVector.longReductionMultiplyMax', will run:
* micro:org.openjdk.bench.java.lang.MinMaxVector.longReductionMultiplyMax
Running test 'micro:org.openjdk.bench.java.lang.MinMaxVector.longReductionMultiplyMax'
Profilers failed to initialize, exiting.
java.lang.reflect.InvocationTargetException
null
Cannot invoke "java.io.InputStream.read(byte[])" because "fis" is null
```
The issue happens because the benchmarks.jar that JDK build generates does not include `default.instruments.template.xml` resource that the JMH core jar includes:
```
$ jar tf jdk/build/release-darwin-arm64/images/test/micro/benchmarks.jar | grep default.instruments
<not output>
```
A benchmarks.jar generated in a Maven JMH project does include it:
```
$ ~/opt/boot-java-24/bin/jar tf benchmarks.jar | grep default
default.instruments.template.xml
```
A workaround that might work would be to pass in the `template` parameter to the profiler and point to the xml somewhere in the system.
- links to
-
Review(master) openjdk/jdk/24571