dtrace, jstack and lang/openjdk7 or 8

Jung-uk Kim jkim at FreeBSD.org
Thu Mar 26 20:42:58 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 03/25/2015 19:02, Johannes Dieterich wrote:
> Hi,
> 
> I am currently trying to get dtrace to work with either
> java/openjdk7 or java/openjdk8 (as per Brendan Gregg's howto: 
> http://www.brendangregg.com/blog/2014-06-12/java-flame-graphs.html).
>
>  Unfortunately, I get exactly what he describes: I am missing 
> everything inside the JVM. I suspect this has to do with jstack()
> not working. The bundled jstack executable (yes, I know that they
> are only vaguely related) also seems to work only so-so. Basically,
> I can get a working stack trace without a variable, with -l, but
> not with -m, and not with -F. It causes exceptions like this:
> 
> $ /usr/local/openjdk7/bin/jstack -m 84749
...
> So, what I am asking is: anybody out there got a working setup for 
> dtrace+openjdk on FreeBSD? If so, it would be fantastic if you
> could post the necessary steps!

jstack from java/openjdk8 works fine AFAICT.  Unfortunately, dtrace is
unimplemented for FreeBSD.

BTW, 'jstack -m <pid>' is invalid command, i.e., it does not work with
a running process.  You need to set '-F' option to force it.

% /usr/local/openjdk8/bin/jstack
Usage:
    jstack [-l] <pid>
        (to connect to running process)
    jstack -F [-m] [-l] <pid>
        (to connect to a hung process)
    jstack [-m] [-l] <executable> <core>
        (to connect to a core file)
    jstack [-m] [-l] [server_id@]<remote server IP or hostname>
        (to connect to a remote debug server)

Options:
    -F  to force a thread dump. Use when jstack <pid> does not respond
(process is hung)
    -m  to print both java and native frames (mixed mode)
    -l  long listing. Prints additional information about locks
    -h or -help to print this help message


Jung-uk Kim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJVFG9MAAoJEHyflib82/FG4F0H/3Z+5fTXMzQYBCeWGMZicjMB
092HOaXctRZ5P+I5HZO199bfFLffV6Pu1pd2/jjguOqkmF4eVL6AXwQBglg19RPs
BEwhSLRLhuWc11XyikE2RG3PvvDRvhXl6AeqtKkcUi4LedjS3BlqmlGpTorJzpO3
OqarnzGMyAHPS5QxPPUcASG4B+la6o1sVn94UiynUWnd3yXTe4uE4Ed4YeV2oBXh
BGVLhTdsWoamNpMwX9JrOMNwRPahYpoDCjeC2jlKPGPCXQiTWthlupLidXuKUI/a
OJi+VSAzNPMx5s1p2JSKwAp+tT6oX8BaFK0zA+J6cyBcBqqbWvA6LV+v9f8c/5A=
=x1pC
-----END PGP SIGNATURE-----


More information about the freebsd-java mailing list