Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Mar 2015 00:02:39 +0100
From:      Johannes Dieterich <dieterich.joh@gmail.com>
To:        freebsd-java@freebsd.org
Subject:   dtrace, jstack and lang/openjdk7 or 8
Message-ID:  <CABquGzWu7Y2v80D8EOfQ8QR9T_hCb9T9t6a%2BkjissxEsKbjLCA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABquGzWu7Y2v80D8EOfQ8QR9T_hCb9T9t6a%2BkjissxEsKbjLCA>