Issues with dtraceasm, and a workaround

Vipin Sharma vipinsharma85 at gmail.com
Mon Feb 22 17:12:40 UTC 2021


Hi,

> On Feb 22, 2021, at 10:21 PM, Aleksey Shipilev <shade at redhat.com> wrote:
> 
> On 2/22/21 5:42 PM, Henri Tremblay wrote:
>> Sadly, I do not get the same result. When running from master I do get
>> # Processing profiler results: DTraceAsmProfiler Exception in thread "main" java.lang.IllegalStateException: [kill: 37996: No such process
>> ]
>> at org.openjdk.jmh.profile.DTraceAsmProfiler.afterTrial(DTraceAsmProfiler.java:94)
>> at org.openjdk.jmh.runner.Runner.runSeparate(Runner.java:682)
>> at org.openjdk.jmh.runner.Runner.runBenchmarks(Runner.java:565)
>> at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:317)
>> at org.openjdk.jmh.runner.Runner.run(Runner.java:209)
>> at org.openjdk.jmh.Main.main(Main.java:71)
>> However, when applying the patch I still have the same error.
>> Running
>> sudo java -jar jmh-samples/target/benchmarks.jar Hello -wi 5 -i 5 -f 1 -w 1s -r 1s -prof dtraceasm
>> However, I do get the exact same issue with the PR. I did a clean install between each run. I'm not sure if if I'm just stupid or something is actually not working.
>> If someone has an idea. I'll debug slightly later.

I had exactly same results, formatting in my email was lost so probably it was not clear enough.

> 
> I might have botched the "kill" line. Either TERM is wrong, or we are killing the wrong PID (forked VM). See if this works?
> 
>   Collection<String> messages = Utils.tryWith("sudo", "kill", "-15", Long.toString(dtraceProcess.pid()));

Yes replacing this line worked for my Mac OS, in case required I can share full console output.

> 
> ...or maybe we should not expect that kill always succeeds, for example when profiler exits itself?
> 
> So it should be this?
> 
>        // We cannot use Process.destroy, because it closes the streams right away.
>        // Instead, deliver TERM by hand and wait for process to gracefully terminate.
>        Utils.tryWith("sudo", "kill", "-TERM", Long.toString(dtraceProcess.pid()));
> 
>        try {
>            // dtrace would exit with non-zero exit code due to TERM,
>            // so we cannot test for errcode == 0 on this path.
>            dtraceProcess.waitFor();
>        } catch (InterruptedException e) {
>            throw new IllegalStateException("Interrupted while waiting for profiler to stop");
>        }
> 
> 
> -- 
> Thanks,
> -Aleksey
> 

Regards,
Vipin


More information about the jmh-dev mailing list