From ashipile at redhat.com Fri Feb 24 12:48:48 2017 From: ashipile at redhat.com (ashipile at redhat.com) Date: Fri, 24 Feb 2017 12:48:48 +0000 Subject: hg: code-tools/jmh: 7901904: perfasm should handle the absence of events gracefully Message-ID: <201702241248.v1OCmmvY001380@aojmv0008.oracle.com> Changeset: c888a60d747f Author: shade Date: 2017-02-24 13:48 +0100 URL: http://hg.openjdk.java.net/code-tools/jmh/rev/c888a60d747f 7901904: perfasm should handle the absence of events gracefully ! jmh-core/src/main/java/org/openjdk/jmh/profile/AbstractPerfAsmProfiler.java From shade at redhat.com Fri Feb 24 12:49:43 2017 From: shade at redhat.com (Aleksey Shipilev) Date: Fri, 24 Feb 2017 13:49:43 +0100 Subject: Random java.util.NoSuchElementException exceptions when using perfasm In-Reply-To: References: Message-ID: Hi, Sorry for very delayed reply. On 01/18/2017 08:34 PM, Bartosz Skrzypczak wrote: > While trying to find some way to reproduce a JVM crash with > JMH+perfasm+gc profiler I got the following exception several times: > > # Processing profiler results: LinuxPerfAsmProfiler Exception in > thread "main" java.util.NoSuchElementException > at java.util.TreeMap.key(TreeMap.java:1327) > at java.util.TreeMap$NavigableSubMap.firstKey(TreeMap.java:1561) > at java.util.TreeSet.first(TreeSet.java:394) > at org.openjdk.jmh.profile.AbstractPerfAsmProfiler.figureHotIntervals(AbstractPerfAsmProfiler.java:707) > at org.openjdk.jmh.profile.AbstractPerfAsmProfiler.makeRegions(AbstractPerfAsmProfiler.java:670) > at org.openjdk.jmh.profile.AbstractPerfAsmProfiler.processAssembly(AbstractPerfAsmProfiler.java:375) > at org.openjdk.jmh.profile.AbstractPerfAsmProfiler.afterTrial(AbstractPerfAsmProfiler.java:273) > at org.openjdk.jmh.runner.Runner.runSeparate(Runner.java:673) > at org.openjdk.jmh.runner.Runner.runBenchmarks(Runner.java:542) > at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:313) > at org.openjdk.jmh.runner.Runner.run(Runner.java:206) > at benchmark.TestBenchmark.main(TestBenchmark.java:80) Another user reported this with a reproducer, and so we were able to pinpoint this. This happens when perf happens to report zero events. This should be fixed with: https://bugs.openjdk.java.net/browse/CODETOOLS-7901904 Thanks, -Aleksey From ashipile at redhat.com Fri Feb 24 16:24:30 2017 From: ashipile at redhat.com (ashipile at redhat.com) Date: Fri, 24 Feb 2017 16:24:30 +0000 Subject: hg: code-tools/jmh: 7901905: perfasm profiler handles event modifiers like "cycles:u" incorrectly Message-ID: <201702241624.v1OGOUhM024827@aojmv0008.oracle.com> Changeset: f65a83dc54af Author: shade Date: 2017-02-24 17:07 +0100 URL: http://hg.openjdk.java.net/code-tools/jmh/rev/f65a83dc54af 7901905: perfasm profiler handles event modifiers like "cycles:u" incorrectly ! jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java + jmh-core/src/test/java/org/openjdk/jmh/profile/PerfParseTest.java From shade at redhat.com Fri Feb 24 21:26:34 2017 From: shade at redhat.com (Aleksey Shipilev) Date: Fri, 24 Feb 2017 22:26:34 +0100 Subject: JMH 1.17.5 Message-ID: <4f336510-e3ef-345a-a51c-8e67993de4a5@redhat.com> Hi, JMH 1.17.5 patch release is at Maven Central. It contains two bugfixes for issues that were experienced by users in the wild: *) perfasm profiler throws weird exceptions when perf is botched: https://bugs.openjdk.java.net/browse/CODETOOLS-7901904 *) perfasm profiler does not like "modified" event names like "cycles:u", which is used by default in some distributions: https://bugs.openjdk.java.net/browse/CODETOOLS-7901905 Thanks, -Aleksey From ashipile at redhat.com Fri Feb 24 21:27:14 2017 From: ashipile at redhat.com (ashipile at redhat.com) Date: Fri, 24 Feb 2017 21:27:14 +0000 Subject: hg: code-tools/jmh: 3 new changesets Message-ID: <201702242127.v1OLRE54006523@aojmv0008.oracle.com> Changeset: 5e3781c05e28 Author: shade Date: 2017-02-24 21:43 +0100 URL: http://hg.openjdk.java.net/code-tools/jmh/rev/5e3781c05e28 JMH v1.17.5. ! jmh-archetypes/jmh-groovy-benchmark-archetype/pom.xml ! jmh-archetypes/jmh-java-benchmark-archetype/pom.xml ! jmh-archetypes/jmh-kotlin-benchmark-archetype/pom.xml ! jmh-archetypes/jmh-scala-benchmark-archetype/pom.xml ! jmh-archetypes/pom.xml ! jmh-core-benchmarks/pom.xml ! jmh-core-ct/pom.xml ! jmh-core-it/pom.xml ! jmh-core/pom.xml ! jmh-generator-annprocess/pom.xml ! jmh-generator-asm/pom.xml ! jmh-generator-bytecode/pom.xml ! jmh-generator-reflection/pom.xml ! jmh-samples/pom.xml ! pom.xml Changeset: 86e340af9f47 Author: shade Date: 2017-02-24 21:43 +0100 URL: http://hg.openjdk.java.net/code-tools/jmh/rev/86e340af9f47 Added tag 1.17.5 for changeset 5e3781c05e28 ! .hgtags Changeset: ecd9e76155fe Author: shade Date: 2017-02-24 21:43 +0100 URL: http://hg.openjdk.java.net/code-tools/jmh/rev/ecd9e76155fe Continue in 1.18-SNAPSHOT. ! jmh-archetypes/jmh-groovy-benchmark-archetype/pom.xml ! jmh-archetypes/jmh-java-benchmark-archetype/pom.xml ! jmh-archetypes/jmh-kotlin-benchmark-archetype/pom.xml ! jmh-archetypes/jmh-scala-benchmark-archetype/pom.xml ! jmh-archetypes/pom.xml ! jmh-core-benchmarks/pom.xml ! jmh-core-ct/pom.xml ! jmh-core-it/pom.xml ! jmh-core/pom.xml ! jmh-generator-annprocess/pom.xml ! jmh-generator-asm/pom.xml ! jmh-generator-bytecode/pom.xml ! jmh-generator-reflection/pom.xml ! jmh-samples/pom.xml ! pom.xml From ivan.mamontov at gmail.com Sun Feb 26 18:40:36 2017 From: ivan.mamontov at gmail.com (Mamontov Ivan) Date: Sun, 26 Feb 2017 21:40:36 +0300 Subject: Random java.util.NoSuchElementException exceptions when using perfasm In-Reply-To: References: Message-ID: I had the same issue with JMH. In my case this issue was caused by environment misconfiguration. By default perf does not record kernel events, so as a result with the following command: > perf record --freq 99 --event cycles,instructions --output /tmp/testbin1 > sleep 1 perf script --fields time,event,ip,sym,dso --input /tmp/testbin1 perf reports the following events: > 4805.282237: cycles:u: 7fa61e26ccd0 _start+0x0 (/usr/lib64/ > ld-2.24.so) > 4805.282243: instructions:u: 7fa61e26ccd0 _start+0x0 (/usr/lib64/ > ld-2.24.so) > 4805.282244: cycles:u: 7fa61e26ccd0 _start+0x0 (/usr/lib64/ > ld-2.24.so) > where u means user space events. Unfortunately jmh expects output like > 4805.282237: cycles: 7fa61e26ccd0 _start+0x0 (/usr/lib64/ > ld-2.24.so) > 4805.282243: instructions: 7fa61e26ccd0 _start+0x0 (/usr/lib64/ > ld-2.24.so) > 4805.282244: cycles: 7fa61e26ccd0 _start+0x0 (/usr/lib64/ > ld-2.24.so) It just replaces each ':' by empty symbol(org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java:134), i.e. cycles:u: -> cyclesu. And skips processing(org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java:160) with comment "we are not prepared to handle this event, skip" So in my case all events were skipped without any notification. I think jmh should take into account such things and report to users in order to not confuse less experienced users by wrong or empty profiles. 2017-01-18 22:34 GMT+03:00 Bartosz Skrzypczak : > While trying to find some way to reproduce a JVM crash with > JMH+perfasm+gc profiler I got the following exception several times: > > # Processing profiler results: LinuxPerfAsmProfiler Exception in > thread "main" java.util.NoSuchElementException > at java.util.TreeMap.key(TreeMap.java:1327) > at java.util.TreeMap$NavigableSubMap.firstKey(TreeMap.java:1561) > at java.util.TreeSet.first(TreeSet.java:394) > at org.openjdk.jmh.profile.AbstractPerfAsmProfiler.figureHotIntervals( > AbstractPerfAsmProfiler.java:707) > at org.openjdk.jmh.profile.AbstractPerfAsmProfiler.makeRegions( > AbstractPerfAsmProfiler.java:670) > at org.openjdk.jmh.profile.AbstractPerfAsmProfiler.processAssembly( > AbstractPerfAsmProfiler.java:375) > at org.openjdk.jmh.profile.AbstractPerfAsmProfiler.afterTrial( > AbstractPerfAsmProfiler.java:273) > at org.openjdk.jmh.runner.Runner.runSeparate(Runner.java:673) > at org.openjdk.jmh.runner.Runner.runBenchmarks(Runner.java:542) > at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:313) > at org.openjdk.jmh.runner.Runner.run(Runner.java:206) > at benchmark.TestBenchmark.main(TestBenchmark.java:80) > > It's even more rare than the JVM crash I was getting, but unlike the > JVM crash this is likely to be an issue with JMH. Unfortunately the > only way I found to maybe get this exception was to run many forks > (>100) with perfasm and gc profilers. I'm also not sure if the > benchmark itself also affects it. > > Could I also get some information at least where should I report the > JVM crash and how to get some crash log? It doesn't generage hs_err > and running with -v EXTRA seems to make the JVM crash go away and > produces huge logs. > -- Thanks, Ivan From ivan.mamontov at gmail.com Sun Feb 26 18:43:34 2017 From: ivan.mamontov at gmail.com (Mamontov Ivan) Date: Sun, 26 Feb 2017 21:43:34 +0300 Subject: Random java.util.NoSuchElementException exceptions when using perfasm In-Reply-To: References: Message-ID: Sorry for excess noise. I did not read change log where the same change was applied https://bugs.openjdk.java.net/browse/CODETOOLS-7901905 2017-02-26 21:40 GMT+03:00 Mamontov Ivan : > I had the same issue with JMH. In my case this issue was caused by > environment misconfiguration. By default perf does not record kernel > events, so as a result with the following command: > >> perf record --freq 99 --event cycles,instructions --output /tmp/testbin1 >> sleep 1 > > perf script --fields time,event,ip,sym,dso --input /tmp/testbin1 > > > perf reports the following events: > >> 4805.282237: cycles:u: 7fa61e26ccd0 _start+0x0 (/usr/lib64/ >> ld-2.24.so) >> 4805.282243: instructions:u: 7fa61e26ccd0 _start+0x0 (/usr/lib64/ >> ld-2.24.so) >> 4805.282244: cycles:u: 7fa61e26ccd0 _start+0x0 (/usr/lib64/ >> ld-2.24.so) >> > > where u means user space events. Unfortunately jmh expects output like > >> 4805.282237: cycles: 7fa61e26ccd0 _start+0x0 (/usr/lib64/ >> ld-2.24.so) >> 4805.282243: instructions: 7fa61e26ccd0 _start+0x0 (/usr/lib64/ >> ld-2.24.so) >> 4805.282244: cycles: 7fa61e26ccd0 _start+0x0 (/usr/lib64/ >> ld-2.24.so) > > > It just replaces each ':' by empty symbol(org/openjdk/jmh/ > profile/LinuxPerfAsmProfiler.java:134), i.e. cycles:u: -> cyclesu. And > skips processing(org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java:160) > with comment "we are not prepared to handle this event, skip" > So in my case all events were skipped without any notification. I think > jmh should take into account such things and report to users in order to > not confuse less experienced users by wrong or empty profiles. > > > > 2017-01-18 22:34 GMT+03:00 Bartosz Skrzypczak : > >> While trying to find some way to reproduce a JVM crash with >> JMH+perfasm+gc profiler I got the following exception several times: >> >> # Processing profiler results: LinuxPerfAsmProfiler Exception in >> thread "main" java.util.NoSuchElementException >> at java.util.TreeMap.key(TreeMap.java:1327) >> at java.util.TreeMap$NavigableSubMap.firstKey(TreeMap.java:1561) >> at java.util.TreeSet.first(TreeSet.java:394) >> at org.openjdk.jmh.profile.AbstractPerfAsmProfiler.figureHotInt >> ervals(AbstractPerfAsmProfiler.java:707) >> at org.openjdk.jmh.profile.AbstractPerfAsmProfiler.makeRegions( >> AbstractPerfAsmProfiler.java:670) >> at org.openjdk.jmh.profile.AbstractPerfAsmProfiler.processAssem >> bly(AbstractPerfAsmProfiler.java:375) >> at org.openjdk.jmh.profile.AbstractPerfAsmProfiler.afterTrial(A >> bstractPerfAsmProfiler.java:273) >> at org.openjdk.jmh.runner.Runner.runSeparate(Runner.java:673) >> at org.openjdk.jmh.runner.Runner.runBenchmarks(Runner.java:542) >> at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:313) >> at org.openjdk.jmh.runner.Runner.run(Runner.java:206) >> at benchmark.TestBenchmark.main(TestBenchmark.java:80) >> >> It's even more rare than the JVM crash I was getting, but unlike the >> JVM crash this is likely to be an issue with JMH. Unfortunately the >> only way I found to maybe get this exception was to run many forks >> (>100) with perfasm and gc profilers. I'm also not sure if the >> benchmark itself also affects it. >> >> Could I also get some information at least where should I report the >> JVM crash and how to get some crash log? It doesn't generage hs_err >> and running with -v EXTRA seems to make the JVM crash go away and >> produces huge logs. >> > > > > -- > Thanks, > Ivan > -- Thanks, Ivan From shade at redhat.com Mon Feb 27 09:00:17 2017 From: shade at redhat.com (Aleksey Shipilev) Date: Mon, 27 Feb 2017 10:00:17 +0100 Subject: Random java.util.NoSuchElementException exceptions when using perfasm In-Reply-To: References: Message-ID: On 02/26/2017 07:43 PM, Mamontov Ivan wrote: > Sorry for excess noise. I did not read change log where the same change was > applied https://bugs.openjdk.java.net/browse/CODETOOLS-7901905 Yes. Our users have already reported this, and this is already fixed in 1.17.5 :) Try it, please? -Aleksey