JDK-8230872 : sun/tools/jhsdb/JShellHeapDumpTest.java fails with RuntimeException: Test ERROR java.io.EOFException
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc-agent
  • Affected Version: 14
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2019-09-11
  • Updated: 2019-09-30
  • Resolved: 2019-09-30
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.
Other
tbdResolved
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8231287 :  
JDK-8231288 :  
Description
Attaching to process ID 5194, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 14-ea+14-539
Error occurred during stack walking:

stderr:

[2019-09-07T13:36:06.119432Z] Waiting for completion for process 5205
[2019-09-07T13:36:06.119633Z] Waiting for completion finished for process 5205
Dump file created Sat Sep 07 13:36:04 UTC 2019
----------System.err:(44/3102)----------
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.runtime.ThreadStackTrace.dumpStack(ThreadStackTrace.java:54)
	at jdk.hotspot.agent/sun.jvm.hotspot.utilities.HeapHprofBinWriter.dumpStackTraces(HeapHprofBinWriter.java:718)
	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: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:321)
	at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:406)
null
java.lang.RuntimeException: Test ERROR java.io.EOFException
	at JShellHeapDumpTest.printStackTraces(JShellHeapDumpTest.java:100)
	at JShellHeapDumpTest.testHeapDump(JShellHeapDumpTest.java:117)
	at JShellHeapDumpTest.main(JShellHeapDumpTest.java:141)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
	at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: java.io.EOFException
	at java.base/java.io.DataInputStream.readFully(DataInputStream.java:202)
	at java.base/java.io.DataInputStream.readLong(DataInputStream.java:421)
	at jdk.test.lib.hprof.parser.HprofReader.readID(HprofReader.java:542)
	at jdk.test.lib.hprof.parser.HprofReader.read(HprofReader.java:230)
	at jdk.test.lib.hprof.parser.Reader.getStack(Reader.java:128)
	at JShellHeapDumpTest.printStackTraces(JShellHeapDumpTest.java:95)
	... 8 more

JavaTest Message: Test threw exception: java.lang.RuntimeException: Test ERROR java.io.EOFException
JavaTest Message: shutting down test

Comments
The CR can be closed now: JShellHeapDumpTest.java no longer reproduces any of these failures due to waiting for the jshell prompt and then waiting an addition 2000ms after that. The new HeapDumpTestWithActiveProcess.java test being added for JDK-8231288 will reproduce them but: - JDK-8196969 will address the NPE issue - JDK-8231634 has been filed for the "illegal bci" issue - JDK-8231635 has been filed for the timeout issue Also, none of these failures still manifest as a EOFException. This was addressed by JDK-8231287, which makes jmap properly exit with an error code if any of this issues (or any other issues) turn up in jmap.
30-09-2019

[~sgehwolf] I'm working on JDK-8231288, which basically will just invoke JShellHeapDumpTest.java with a special argument that will make it skip the Thread.sleep(2000). This normally reproduces a variety of issues as documented in in this CR. Your fix for JDK-8196969 does seem to clear up the NPE I was seeing: java.lang.NullPointerException at jdk.hotspot.agent/sun.jvm.hotspot.utilities.HeapHprofBinWriter.dumpStackTraces(HeapHprofBinWriter.java:727) 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) But I still see "illegal bci": 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) I also still see the timeout, which is due to jmap getting stuck in this backtrace: at sun.jvm.hotspot.types.basic.BasicTypeDataBase.findDynamicTypeForAddress(jdk.hotspot.agent@14-internal/BasicTypeDataBase.java:328) at sun.jvm.hotspot.runtime.VirtualBaseConstructor.instantiateWrapperFor(jdk.hotspot.agent@14-internal/VirtualBaseConstructor.java:102) at sun.jvm.hotspot.utilities.GrowableArray.at(jdk.hotspot.agent@14-internal/GrowableArray.java:61) at sun.jvm.hotspot.code.CodeCache.findBlobUnsafe(jdk.hotspot.agent@14-internal/CodeCache.java:102) at sun.jvm.hotspot.code.CodeCache.findBlob(jdk.hotspot.agent@14-internal/CodeCache.java:85) at sun.jvm.hotspot.runtime.x86.X86Frame.sender(jdk.hotspot.agent@14-internal/X86Frame.java:282) at sun.jvm.hotspot.runtime.Frame.sender(jdk.hotspot.agent@14-internal/Frame.java:205) at sun.jvm.hotspot.runtime.amd64.AMD64CurrentFrameGuess.run(jdk.hotspot.agent@14-internal/AMD64CurrentFrameGuess.java:140) at sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess.getCurrentFrameGuess(jdk.hotspot.agent@14-internal/LinuxAMD64JavaThreadPDAccess.java:95) at sun.jvm.hotspot.runtime.JavaThread.getCurrentFrameGuess(jdk.hotspot.agent@14-internal/JavaThread.java:265) at sun.jvm.hotspot.runtime.JavaThread.getLastJavaVFrameDbg(jdk.hotspot.agent@14-internal/JavaThread.java:227) at sun.jvm.hotspot.runtime.ThreadStackTrace.dumpStack(jdk.hotspot.agent@14-internal/ThreadStackTrace.java:54) at sun.jvm.hotspot.utilities.HeapHprofBinWriter.dumpStackTraces(jdk.hotspot.agent@14-internal/HeapHprofBinWriter.java:718) at sun.jvm.hotspot.utilities.HeapHprofBinWriter.write(jdk.hotspot.agent@14-internal/HeapHprofBinWriter.java:439) - locked <0x0000000415c585c8> (a sun.jvm.hotspot.utilities.HeapHprofBinWriter) at sun.jvm.hotspot.tools.JMap.writeHeapHprofBin(jdk.hotspot.agent@14-internal/JMap.java:182) at sun.jvm.hotspot.tools.JMap.run(jdk.hotspot.agent@14-internal/JMap.java:97) at sun.jvm.hotspot.tools.Tool.startInternal(jdk.hotspot.agent@14-internal/Tool.java:262) at sun.jvm.hotspot.tools.Tool.start(jdk.hotspot.agent@14-internal/Tool.java:225) at sun.jvm.hotspot.tools.Tool.execute(jdk.hotspot.agent@14-internal/Tool.java:118) at sun.jvm.hotspot.tools.JMap.main(jdk.hotspot.agent@14-internal/JMap.java:176) at sun.jvm.hotspot.SALauncher.runJMAP(jdk.hotspot.agent@14-internal/SALauncher.java:321) at sun.jvm.hotspot.SALauncher$$Lambda$4/0x0000000800ba5c40.accept(jdk.hotspot.agent@14-internal/Unknown Source) at sun.jvm.hotspot.SALauncher.main(jdk.hotspot.agent@14-internal/SALauncher.java:406)
30-09-2019

Adding a link to JDK-8196969 as I believe re-testing this with the proposed fix for JDK-8196969 will be helpful. It should fix the asserts: invalid index and illegal bci issue.
30-09-2019

[~cjplummer] I'm looking at JDK-8196969 currently, and one of the class of issues once the immediate NPE is dodged (CompiledVFrame.getMethod() returned null) is seeing "sun.jvm.hotspot.utilities.AssertionFailure: must be a valid non-zero index" with a stack trace similar to this: 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) So I tend to think that JDK-8204757 is a duplicate of JDK-8196969 and the issue you are seeing. While looking at a reproducer of JDK-8196969 I've also seen "sun.jvm.hotspot.utilities.AssertionFailure: illegal bci". In my case it looks like so: ---> vframe: sun.jvm.hotspot.runtime.InterpretedVFrame@fbf08c0 ---> method: sun.jvm.hotspot.oops.Method@0x000000080004f7a8 - java.util.regex.Pattern$GroupHead.match(java.util.regex.Matcher, int, java.lang.CharSequence) @bci=1471194928Error occurred during stack walking: 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:89) 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) or: "main" #1 prio=5 tid=0x00007f4d50018800 nid=0x3d3aa runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE JavaThread state: _thread_in_java ---> vframe: sun.jvm.hotspot.runtime.InterpretedVFrame@fbf3848 ---> method: sun.jvm.hotspot.oops.Method@0x000000080004f7a8 - java.util.regex.Pattern$GroupHead.match(java.util.regex.Matcher, int, java.lang.CharSequence) @bci=1471201144Error occurred during stack walking: 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:89) 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) Note the strange BCI index of "1471201144" and "1471194928".
20-09-2019

The "null" and "illegal bci" are are being printed out by the following in JMap.java: public boolean writeHeapHprofBin(String fileName) { try { HeapGraphWriter hgw = new HeapHprofBinWriter(); hgw.write(fileName); System.out.println("heap written to " + fileName); return true; } catch (IOException | RuntimeException exp) { System.err.println(exp.getMessage()); <----------- return false; } } The "null" is because the exception has no message, and this is what String.valueOf(obj) returns in that case. The "illegal bci" is the message from the AssertionFailure exception that is being caught here. I think this code should be changed to the following to there is more reasonable detail in the output: exp.printStackTrace(System.err); Once this is done, you see a better explanation for the failures: 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: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:321) at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:406) 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.runtime.ThreadStackTrace.dumpStack(ThreadStackTrace.java:54) at jdk.hotspot.agent/sun.jvm.hotspot.utilities.HeapHprofBinWriter.dumpStackTraces(HeapHprofBinWriter.java:718) 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: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:321) at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:406) And this is the one for the "null" message: java.lang.NullPointerException at jdk.hotspot.agent/sun.jvm.hotspot.utilities.HeapHprofBinWriter.dumpStackTraces(HeapHprofBinWriter.java:727) 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: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:321) at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:406) There may be others. This is just what I've seen so far. Also, as pointed out above, there's also the hung/deadlock case in sun.jvm.hotspot.types.basic.BasicTypeDataBase.findDynamicTypeForAddress(). This results in a timeout. Now the reason that these failures (other than the timeout) result in EOFException by the test rather than detecting the bad jmap output is because of a couple of reasons. The first is because the only bad output it checks for is "null", so the assertion error messages are not even seen. However it ends up not seeing the "null" either because the following prevents any of the jmap stderr output from appearing in the process output: processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT); Thus the following check doesn't catch the "null": output.shouldNotContain("null"); As a result of this the test thinks that jmap completed with no errors, and goes ahead and tries to read the missing or incomplete hprof file, resulting in an EOFException. I think the processBuilder.redirectError() issue and the missing printStackTrace() in JMap.java should be addressed by a subtask to this CR. As for the root issue, it's unclear at this point, other than it seems to happen because SA attaches while the application is still starting up.
18-09-2019

The EOFException seems to be due to the hprof file never being written. Usually when "jhsdb jmap" is run by the test, you see the following output when the process completes: Attaching to process ID 12899, please wait... Debugger attached successfully. Server compiler detected. JVM version is 14-internal+0-2019-09-09-2129206.cplummer... heap written to /local/ws/jdk/jdk.clean/build/linux-x64-debug/test-support/jtreg_open_test_jdk_sun_tools_jhsdb_JShellHeapDumpTest_java/scratch/0/jhsdb.jmap.heap.1568402565308.hprof The test then tries to read in the hprof file. When we wee the EOFException, there is no "heap written" message in the jmap output, thus the assumption is the hprof file was never written to, resulting in the EOF when the test tries to read from it. It's unclear why the jmap process completes without ever writing the hprof file. There is no other output in the stderr or stdout of the jmap process that is any different than when it works, other than the missing "heap written" message. However, I did uncover one clue. jmap is attaching to the jshell process that the test sets up first. I added some additional code to the test to dump the output of the shell process. Normally you see: jshell stdout: | Welcome to JShell -- Version 14-internal | For an introduction type: /help intro jshell stderr: However when getting the EOFException, there is no jshell output. There area also a few other failure modes that all seem related. In all cases I see no jshell output and I see no indication of the hprof file being produced. I'll cover them in the following comments.
16-09-2019