Bug 1752173
| Summary: | jstack -F hits NPE during some application pattern calls | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Aaron Ogburn <aogburn> | ||||
| Component: | java-1.8.0-openjdk | Assignee: | Severin Gehwolf <sgehwolf> | ||||
| Status: | CLOSED ERRATA | QA Contact: | OpenJDK QA <java-qa> | ||||
| Severity: | high | Docs Contact: | |||||
| Priority: | high | ||||||
| Version: | 7.7 | CC: | ahughes, aph, dbhole, fdemeloj, jandrlik, jvanek, loskutov, pmikova, sgehwolf, simeon.andreev | ||||
| Target Milestone: | rc | ||||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | java-1.8.0-openjdk-1.8.0.262.b04-0.1.ea.el7 | Doc Type: | If docs needed, set a value | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2020-09-29 19:54:11 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
Created attachment 1615044 [details] bz1752173repro.zip *** Bug 1750768 has been marked as a duplicate of this bug. *** This reproduces with JDK 11 and JDK head (JDK 14) as well and is related to compiled frames being on the stack. The command for JDK 11+ is "jhsdb jstack --mixed --pid <PID>" over "jstack -F <PID>". Stack trace for JDK 11 looks like this: Attaching to process ID 383780, please wait... Debugger attached successfully. Server compiler detected. JVM version is 11.0.4+11 sun.jvm.hotspot.utilities.AssertionFailure: must be a valid non-zero index at jdk.hotspot.agent/sun.jvm.hotspot.utilities.Assert.that(Assert.java:32) at jdk.hotspot.agent/sun.jvm.hotspot.code.NMethod.getMetadataAt(NMethod.java:204) at jdk.hotspot.agent/sun.jvm.hotspot.code.NMethod.getMethodAt(NMethod.java:210) at jdk.hotspot.agent/sun.jvm.hotspot.code.DebugInfoReadStream.readMethod(DebugInfoReadStream.java:58) at jdk.hotspot.agent/sun.jvm.hotspot.code.ScopeDesc.<init>(ScopeDesc.java:64) at jdk.hotspot.agent/sun.jvm.hotspot.code.ScopeDesc.sender(ScopeDesc.java:121) at jdk.hotspot.agent/sun.jvm.hotspot.runtime.CompiledVFrame.sender(CompiledVFrame.java:187) at jdk.hotspot.agent/sun.jvm.hotspot.runtime.VFrame.javaSender(VFrame.java:143) at jdk.hotspot.agent/sun.jvm.hotspot.tools.PStack.initJFrameCache(PStack.java:207) at jdk.hotspot.agent/sun.jvm.hotspot.tools.PStack.run(PStack.java:71) at jdk.hotspot.agent/sun.jvm.hotspot.tools.PStack.run(PStack.java:58) at jdk.hotspot.agent/sun.jvm.hotspot.tools.PStack.run(PStack.java:53) at jdk.hotspot.agent/sun.jvm.hotspot.tools.JStack.run(JStack.java:67) at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260) at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:223) at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:118) at jdk.hotspot.agent/sun.jvm.hotspot.tools.JStack.runWithArgs(JStack.java:90) at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runJSTACK(SALauncher.java:251) at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:472) Deadlock Detection: For JDK 14 it looks similar: Attaching to process ID 384120, please wait... Debugger attached successfully. Server compiler detected. JVM version is 14-internal+0-adhoc.sgehwolf.openjdk-head sun.jvm.hotspot.utilities.AssertionFailure: must be a valid non-zero index at jdk.hotspot.agent/sun.jvm.hotspot.utilities.Assert.that(Assert.java:32) at jdk.hotspot.agent/sun.jvm.hotspot.code.NMethod.getMetadataAt(NMethod.java:200) at jdk.hotspot.agent/sun.jvm.hotspot.code.NMethod.getMethodAt(NMethod.java:206) at jdk.hotspot.agent/sun.jvm.hotspot.code.DebugInfoReadStream.readMethod(DebugInfoReadStream.java:58) at jdk.hotspot.agent/sun.jvm.hotspot.code.ScopeDesc.<init>(ScopeDesc.java:64) at jdk.hotspot.agent/sun.jvm.hotspot.code.ScopeDesc.sender(ScopeDesc.java:121) at jdk.hotspot.agent/sun.jvm.hotspot.runtime.CompiledVFrame.sender(CompiledVFrame.java:187) at jdk.hotspot.agent/sun.jvm.hotspot.runtime.VFrame.javaSender(VFrame.java:143) at jdk.hotspot.agent/sun.jvm.hotspot.tools.PStack.initJFrameCache(PStack.java:208) at jdk.hotspot.agent/sun.jvm.hotspot.tools.PStack.run(PStack.java:71) at jdk.hotspot.agent/sun.jvm.hotspot.tools.PStack.run(PStack.java:58) at jdk.hotspot.agent/sun.jvm.hotspot.tools.PStack.run(PStack.java:53) at jdk.hotspot.agent/sun.jvm.hotspot.tools.JStack.run(JStack.java:67) at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260) at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:223) at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:118) at jdk.hotspot.agent/sun.jvm.hotspot.tools.JStack.runWithArgs(JStack.java:90) at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runJSTACK(SALauncher.java:290) at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:406) Deadlock Detection: So far I haven't reproduced this with -Xint being passed to the java command for Testpattern. Similarly excluding java.util.regex.Pattern from JIT compiling. Excluding just java.util.regex.Pattern$Branch.match() and java.util.regex.Pattern$NotBehind.match() from JIT compilation seems to reduce the frequency of this occurring somewhat: $ java -XX:CompileCommand="exclude java/util/regex/Pattern\$Branch::match" -XX:CompileCommand="exclude java/util/regex/Pattern\$NotBehind::match" TestPattern CompilerOracle: exclude java/util/regex/Pattern$Branch.match CompilerOracle: exclude java/util/regex/Pattern$NotBehind.match ### Excluding compile: java.util.regex.Pattern$Branch::match ### Excluding compile: java.util.regex.Pattern$NotBehind::match [...] (In reply to Severin Gehwolf from comment #4) > This reproduces with JDK 11 and JDK head (JDK 14) as well and is related to > compiled frames being on the stack. > > The command for JDK 11+ is "jhsdb jstack --mixed --pid <PID>" over "jstack> -F <PID>". Correction. In JDK 11+ the command is (no --mixed): $ jhsdb jstack --pid <PID> For JDK 14 the error looks like this: Attaching to process ID 180596, please wait... Debugger attached successfully. Server compiler detected. JVM version is 14-internal+0-adhoc.sgehwolf.openjdk-head-2 Deadlock Detection: No deadlocks found. "main" #1 prio=5 tid=0x00007efcec018000 nid=0x2c175 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE JavaThread state: _thread_in_java Error occurred during stack walking: java.lang.NullPointerException at jdk.hotspot.agent/sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:83) at jdk.hotspot.agent/sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:45) at jdk.hotspot.agent/sun.jvm.hotspot.tools.JStack.run(JStack.java:67) at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260) at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:223) at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:118) at jdk.hotspot.agent/sun.jvm.hotspot.tools.JStack.runWithArgs(JStack.java:90) at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runJSTACK(SALauncher.java:290) at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:406) This seems to be upstream bug JDK-8196969 and seems intermittent. The reproducer at hand seems to trigger it more often. I'll see if I can come up with a somewhat reliable jtreg test. Hi Severin, thanks for examining this bug. But is there any chance you or your colleagues can look into: https://bugzilla.redhat.com/show_bug.cgi?id=1751985 This is a RHEL bugzilla ticket for this OpenJDK bug: https://bugs.openjdk.java.net/browse/JDK-8227269 Our R&D would really like a fix in the next official OpenJDK release (and the code freeze for that according to the 1.8 schedule is nearing). Sorry if this is not your area or your teams area, I thought I might ask seeing that there is no developer activity on the RHEL ticket (1751985). Unfortunately we have no contacts to OpenJDK developers and also no account at OpenJDK. If you or your colleagues are able to at least link the RHEL bugzilla ticket to the OpenJDK one (or mention it in the OpenJDK ticket), even that would probably be of great help. Best regards and thanks, Simeon Posted and RFR for this upstream: http://mail.openjdk.java.net/pipermail/serviceability-dev/2019-September/029347.html Hello, any update on this? (In reply to Francisco De Melo from comment #10) > Hello, any update on this? JDK-8196969 has been fixed upstream. I'll investigate possible avenues of getting a fix included in stable release trains. Thank you very much! great! Moving to rhel-7.9. Hello Severin, which OpenJDK version will have this fix? Sorry, it's not clear for me. (In reply to Francisco De Melo from comment #19) > Hello Severin, which OpenJDK version will have this fix? > Sorry, it's not clear for me. Right now, it's in 11.0.7. So any EA build from [1] should have it fixed. I don't have jdk8u approval yet, so it's not been pushed to JDK 8u upstream. [1] https://adoptopenjdk.net/upstream.html?variant=openjdk11&ga=ea (In reply to Francisco De Melo from comment #19) > Hello Severin, which OpenJDK version will have this fix? > Sorry, it's not clear for me. This has been integrated into OpenJDK 8u262 now too. Any EA build better than -b04 should have the fix: https://adoptopenjdk.net/upstream.html?variant=openjdk8&ga=ea Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (java-1.8.0-openjdk bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:3920 |
Description of problem: When using jstack -F, not all thread stacks are listed. Instead, an error is listed for a thread which is in an endless loop due to Java pattern processing. Thread 12105: (state = IN_JAVA) Error occurred during stack walking: java.lang.NullPointerException at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:88) at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:45) at sun.jvm.hotspot.tools.JStack.run(JStack.java:66) at sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260) at sun.jvm.hotspot.tools.Tool.start(Tool.java:223) at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118) at sun.jvm.hotspot.tools.JStack.main(JStack.java:92) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at sun.tools.jstack.JStack.runJStackTool(JStack.java:140) at sun.tools.jstack.JStack.main(JStack.java:106) Version-Release number of selected component (if applicable): java-1.8.0-openjdk-1.8.0.222.b10-4 How reproducible: Very Steps to Reproduce: 1. java TestPattern (attached) 2. Find the process PID of the running Java application 3. Call jstack -F <PID>. 4. Observe that often, the above error is seen Actual results: Frequent NPE Expected results: No NPE