I saw the following failure with ClhsdbThread.java once on Windows:
java.lang.RuntimeException: Test ERROR java.lang.RuntimeException: 'Base of Stack:' missing from stdout/stderr
at ClhsdbThread.main(ClhsdbThread.java:108)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
at java.base/java.lang.Thread.run(Thread.java:1480)
Caused by: java.lang.RuntimeException: 'Base of Stack:' missing from stdout/stderr
at jdk.test.lib.process.OutputAnalyzer.shouldMatch(OutputAnalyzer.java:340)
at ClhsdbLauncher.runCmd(ClhsdbLauncher.java:166)
at ClhsdbLauncher.run(ClhsdbLauncher.java:203)
at ClhsdbThread.main(ClhsdbThread.java:104)
... 4 more
In the log you also see:
...
18 Finalizer
State: BLOCKED
Stack in use by Java: 0x000000864f1ff0d0 .. 0x000000864f1ff300
Base of Stack: 0x000000864f200000
Last_Java_SP: 0x000000864f1ff0d0
Last_Java_FP: null
Last_Java_PC: 0x000001bce09683e3
...
Thread Id obtained is: 18
...
hsdb> + thread 18
Couldn't find thread thread
The test finds the above "Finalizer" thread output, gleans the threadId from it, and then attempts to use the thread command on that threadId, but there is no longer a thread with that threadId.
This appears to be the same issue as JDK-8280770. Basically each time you attach to a target JVM, thread Id's can change. There is some explanation as to why this can happen in the CR:
https://bugs.openjdk.java.net/browse/JDK-8280770?focusedCommentId=14472814&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14472814
And also some discussion in the PR:
https://github.com/openjdk/jdk/pull/7259#issuecomment-1024508580
So bottom line is that you cannot reliable glean usable threadIds from a previous clhsdb shell session in this manner. The fix for JDK-8280770 was to just accept that on Windows you it might not work, so the output is no longer checked. We can do the same for this test.