JDK-8231634 : SA stack walking fails with "illegal bci"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc-agent
  • Affected Version: 14,15
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-09-30
  • Updated: 2020-11-04
  • Resolved: 2020-04-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 15
15 b21Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
When running "jhsdb jmap" on on java process, on occasion you will get an "illegal bci" assertion, resulting in jmap failing. For the most part our jmap tests never see this, I believe because all threads are idle (blocked). When you have an active process, you see this failure somewhat frequently. The new HeapDumpTestWithActiveProcess.java test uncovers it on about 3% of runs on linux-x64.

I believe this issue was introduced by JDK-6760477, which added stack traces to the jmap heap dump.

Note this issue is also covered by JDK-8230872, which I will be closing once I get appropriate CRs files.

jhsdb jmap stderr:
sun.jvm.hotspot.utilities.AssertionFailure: illegal bci
	at jdk.hotspot.agent/sun.jvm.hotspot.utilities.Assert.that(Assert.java:32)
	at jdk.hotspot.agent/sun.jvm.hotspot.oops.ConstMethod.getLineNumberFromBCI(ConstMethod.java:297)
	at jdk.hotspot.agent/sun.jvm.hotspot.oops.Method.getLineNumberFromBCI(Method.java:282)
	at jdk.hotspot.agent/sun.jvm.hotspot.utilities.HeapHprofBinWriter.dumpStackFrame(HeapHprofBinWriter.java:751)
	at jdk.hotspot.agent/sun.jvm.hotspot.utilities.HeapHprofBinWriter.dumpStackTraces(HeapHprofBinWriter.java:730)
	at jdk.hotspot.agent/sun.jvm.hotspot.utilities.HeapHprofBinWriter.write(HeapHprofBinWriter.java:439)
	at jdk.hotspot.agent/sun.jvm.hotspot.tools.JMap.writeHeapHprofBin(JMap.java:182)
	at jdk.hotspot.agent/sun.jvm.hotspot.tools.JMap.run(JMap.java:97)
	at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:262)
	at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:225)
	at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
	at jdk.hotspot.agent/sun.jvm.hotspot.tools.JMap.main(JMap.java:176)
	at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runJMAP(SALauncher.java:321)
	at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:406)
Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/1d09feee810c User: cjplummer Date: 2020-04-28 20:37:40 +0000
28-04-2020

Introduced by the fix for JDK-8214226. Only happens on Linux because that's the only platform that fix was fully applied for.
23-04-2020

Currently still on 11.0.5 but the merge with 11.0.6 is just waiting to be integrated.
28-01-2020

[~twisti]That appears to be a different bug. JDK-8204757 has already been filed for it. There are indications that it is a dup of JDK-8196969, which was fixed in 14 and backported to 11.0.7. What version of 11 are you running.
27-01-2020

We are seeing these errors in our nightly testing at Twitter with JDK 11 with C2 and Graal: 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.runtime.ThreadStackTrace.dumpStack(ThreadStackTrace.java:54) at jdk.hotspot.agent/sun.jvm.hotspot.utilities.HeapHprofBinWriter.dumpStackTraces(HeapHprofBinWriter.java:713) at jdk.hotspot.agent/sun.jvm.hotspot.utilities.HeapHprofBinWriter.write(HeapHprofBinWriter.java:434) at jdk.hotspot.agent/sun.jvm.hotspot.tools.JMap.writeHeapHprofBin(JMap.java:182) at jdk.hotspot.agent/sun.jvm.hotspot.tools.JMap.run(JMap.java:97) 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.JMap.main(JMap.java:176) at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runJMAP(SALauncher.java:329) at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:488)
27-01-2020

The test serviceability/sa/ClhsdbJstackXcompStress.java fails with "illegal bci".: stderr: [sun.jvm.hotspot.utilities.AssertionFailure: illegal bci at jdk.hotspot.agent/sun.jvm.hotspot.utilities.Assert.that(Assert.java:32) at jdk.hotspot.agent/sun.jvm.hotspot.oops.ConstMethod.getLineNumberFromBCI(ConstMethod.java:297) at jdk.hotspot.agent/sun.jvm.hotspot.oops.Method.getLineNumberFromBCI(Method.java:282) at jdk.hotspot.agent/sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:86) 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:262) at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:225) 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)
07-11-2019

JDK-8200217 shows getting this same "illegal bci" exception, but while running jstack.
10-10-2019