Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

dtrace, jstack and lang/openjdk7 or 8

6 views
Skip to first unread message

Johannes Dieterich

unread,
Mar 25, 2015, 7:02:44 PM3/25/15
to
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
Attaching to process ID 84749, please wait...
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.tools.jstack.JStack.runJStackTool(JStack.java:136)
at sun.tools.jstack.JStack.main(JStack.java:102)
Caused by: sun.jvm.hotspot.debugger.UnalignedAddressException: 746f705b762f4867
at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal$1.checkAlignment(BsdDebuggerLocal.java:183)
at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.readCInteger(BsdDebuggerLocal.java:485)
at sun.jvm.hotspot.debugger.DebuggerBase.readAddressValue(DebuggerBase.java:454)
at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.readAddress(BsdDebuggerLocal.java:430)
at sun.jvm.hotspot.debugger.bsd.BsdAddress.getAddressAt(BsdAddress.java:74)
at sun.jvm.hotspot.HotSpotTypeDataBase.readVMTypes(HotSpotTypeDataBase.java:154)
at sun.jvm.hotspot.HotSpotTypeDataBase.<init>(HotSpotTypeDataBase.java:85)
at sun.jvm.hotspot.bugspot.BugSpotAgent.setupVM(BugSpotAgent.java:573)
at sun.jvm.hotspot.bugspot.BugSpotAgent.go(BugSpotAgent.java:494)
at sun.jvm.hotspot.bugspot.BugSpotAgent.attach(BugSpotAgent.java:332)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:163)
at sun.jvm.hotspot.tools.JStack.main(JStack.java:86)
... 6 more

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!

Thanks a lot!

Johannes
_______________________________________________
freebs...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "freebsd-java...@freebsd.org"

Jung-uk Kim

unread,
Mar 26, 2015, 4:43:04 PM3/26/15
to
-----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-----

Dmitry Samersoff

unread,
Mar 27, 2015, 3:00:06 AM3/27/15
to

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jung-uk Kim,

> 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.

jstack -m turns on -F internally so command it self is OK.

The problem is jstack -F uses serviceability agent (see
hotspot/agent) as a backend and as far as I know this backend
is not ported to FreeBSD

- -Dmitry
> _______________________________________________
> freebs...@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-java
> To unsubscribe, send any mail to "freebsd-java...@freebsd.org"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJVFP/sAAoJEHEy08c4gIABIKEH/iGdHwDoMOJJm5eW4Rbasmt/
yFd5HuEXaCDwXGPI7cDlmXDeUZxBEUwy+S9611e9jFRwiS5NuQzYnrpuIZ4d+QQC
gP9gCbFvEi8vac34NCt2urar3zfJNgjs3X5A/4cMN6ZpE/NlbNAPEZw/sKbYxij1
rFWxYdqH8zFD2Fcabcs0DQEFFYO2O8B0L7DrvUU0k2sZu/hhkNopp812eNL1ZDWn
qFWG8RdBMKOKCZ74FHzjkR8quTzfTDfDC5ijI3lYFUkCTYX5z73zOAOK69de2v+p
xefQSvI84/IIZhQJbvgFG9Oe3MtrS5A3thCB4sm2mkukJIB4zS6gPQyebvrvOAw=
=IfYl
0 new messages