When running jtreg test with an agent library (Async Profiler in this case), for example:
$ make test JTREG="VERBOSE=summary,fail,error;JAVA_OPTIONS=-agentpath:../async-profiler/lib/libasyncProfiler.dylib=start,event=cpu,cstack=vm,loglevel=none,flat,file=/dev/null" TEST="test/jdk/sun/tools/jstack/DeadlockDetectionTest.java test/hotspot/jtreg/compiler/jvmci/events/JvmciShutdownEventTest.java test/hotspot/jtreg/gc/g1/ihop/TestIHOPStatic.java"
Some of the tests fail with a message like the one below:
===
Starting DeadlockDetectionTest
Command line: ['.../jdk/bin/java' '-ea' '-esa' '-agentpath:.../lib/libasyncProfiler.so=start,event=cpu,cstack=vm,loglevel=none,flat,file=/dev/null' '-ea' '-esa' '-agentpath:.../lib/libasyncProfiler.so=start,event=cpu,cstack=vm,loglevel=none,flat,file=/dev/null' '-cp' '.../JTwork/jdk_rerun/classes/sun/tools/jstack/DeadlockDetectionTest.d:.../JTwork/jdk_rerun/classes/sun/tools/jstack/DeadlockDetectionTest.d/test/lib' 'jdk.test.lib.apps.LingeredAppWithDeadlock' '5104cbde-2f1a-4c53-a14e-2c4a2455885c.lck']
LingeredApp failed to start or failed to crash. isAlive=false: java.io.IOException: App exited unexpectedly with 1
LingeredApp stdout: [Error occurred during initialization of VM
agent library failed Agent_OnLoad: .../lib/libasyncProfiler.so
];
LingeredApp stderr: []
LingeredApp exitValue = 1
===
Note that above the -agentpath... occurs twice, which causes LingeredApp to fail.
This can be fixed on individual test level, however it can be tricky (e.g., DeadlockDetectionTest copies all the arguments of the parent process obtained via JMX and then adds test VM args on top of it).
It is much easier to fix this on test framework level, doing deduplication of -agent and -javaagent options.
It is easier to fix it on test framework level.
$ make test JTREG="VERBOSE=summary,fail,error;JAVA_OPTIONS=-agentpath:../async-profiler/lib/libasyncProfiler.dylib=start,event=cpu,cstack=vm,loglevel=none,flat,file=/dev/null" TEST="test/jdk/sun/tools/jstack/DeadlockDetectionTest.java test/hotspot/jtreg/compiler/jvmci/events/JvmciShutdownEventTest.java test/hotspot/jtreg/gc/g1/ihop/TestIHOPStatic.java"
Some of the tests fail with a message like the one below:
===
Starting DeadlockDetectionTest
Command line: ['.../jdk/bin/java' '-ea' '-esa' '-agentpath:.../lib/libasyncProfiler.so=start,event=cpu,cstack=vm,loglevel=none,flat,file=/dev/null' '-ea' '-esa' '-agentpath:.../lib/libasyncProfiler.so=start,event=cpu,cstack=vm,loglevel=none,flat,file=/dev/null' '-cp' '.../JTwork/jdk_rerun/classes/sun/tools/jstack/DeadlockDetectionTest.d:.../JTwork/jdk_rerun/classes/sun/tools/jstack/DeadlockDetectionTest.d/test/lib' 'jdk.test.lib.apps.LingeredAppWithDeadlock' '5104cbde-2f1a-4c53-a14e-2c4a2455885c.lck']
LingeredApp failed to start or failed to crash. isAlive=false: java.io.IOException: App exited unexpectedly with 1
LingeredApp stdout: [Error occurred during initialization of VM
agent library failed Agent_OnLoad: .../lib/libasyncProfiler.so
];
LingeredApp stderr: []
LingeredApp exitValue = 1
===
Note that above the -agentpath... occurs twice, which causes LingeredApp to fail.
This can be fixed on individual test level, however it can be tricky (e.g., DeadlockDetectionTest copies all the arguments of the parent process obtained via JMX and then adds test VM args on top of it).
It is much easier to fix this on test framework level, doing deduplication of -agent and -javaagent options.
It is easier to fix it on test framework level.
- links to
-
Review(master)
openjdk/jdk/29684