Bug 211196 - java/openjdk8: thread id missing from jstack output against core files
Summary: java/openjdk8: thread id missing from jstack output against core files
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Greg Lewis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-18 12:09 UTC by Ron Roskens
Modified: 2016-12-18 20:44 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (java)


Attachments
patch for hotspot/src/os/bsd/vm/os_bsd.cpp (1.00 KB, patch)
2016-07-18 12:09 UTC, Ron Roskens
no flags Details | Diff
patch for hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThread.java (515 bytes, patch)
2016-07-18 12:10 UTC, Ron Roskens
no flags Details | Diff
jstack output (90.84 KB, text/plain)
2016-07-18 12:11 UTC, Ron Roskens
no flags Details
jstack -m output (149.65 KB, text/plain)
2016-07-18 12:11 UTC, Ron Roskens
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Roskens 2016-07-18 12:09:14 UTC
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.
Comment 1 Ron Roskens 2016-07-18 12:10:02 UTC
Created attachment 172644 [details]
patch for hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThread.java
Comment 2 Ron Roskens 2016-07-18 12:11:06 UTC
Created attachment 172645 [details]
jstack output
Comment 3 Ron Roskens 2016-07-18 12:11:27 UTC
Created attachment 172646 [details]
jstack -m output
Comment 4 Greg Lewis freebsd_committer freebsd_triage 2016-09-03 23:47:43 UTC
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?
Comment 5 commit-hook freebsd_committer freebsd_triage 2016-09-04 04:06:56 UTC
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