Created attachment 172643 [details] patch for hotspot/src/os/bsd/vm/os_bsd.cpp When analyzing a JVM core dump, jstack is unable to display any stacktraces for any threads because it cannot match any thread id's. In the JVM on BSD, a thread is represented by two different thread id values, however, only when defined(__APPLE__) does the second value, unique_thread_id, get set. Its unique_thread_id that jstack uses to match thread ids in a core dump. I've been using the attached two local patches. patch-rjr-os_bsd.cpp sets unique_thread_id to the same value as the thread_id. patch-rjr-BsdThread.java adds the unique_thread_id to BsdThread.toString() output.
Created attachment 172644 [details] patch for hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThread.java
Created attachment 172645 [details] jstack output
Created attachment 172646 [details] jstack -m output
Ron, thanks for sending these patches. I'd really like to push them upstream into the BSD OpenJDK repo. But to do so you'd need to be a contributor. How do you feel about following the procedure at http://openjdk.java.net/contribute/ and getting an OCA on file with Oracle?
A commit references this bug: Author: glewis Date: Sun Sep 4 04:06:01 UTC 2016 New revision: 421302 URL: https://svnweb.freebsd.org/changeset/ports/421302 Log: . Include the thread id so that jstack can provide stack traces when analysing core dumps. . Bump PORTREVISION. PR: 211196 Submitted by: Ron Roskens <ronald.roskens@gmail.com> Changes: head/java/openjdk8/Makefile head/java/openjdk8/files/patch-hotspot-agent-src-share-classes-sun-jvm-hotspot-debugger-bsd-BsdThread.java head/java/openjdk8/files/patch-hotspot-src-os-bsd-vm-os_bsd.cpp