We're using Wildfly 11 with Java 8 on Amazon Linux. We recently installed jstack
to troubleshoot a high CPU utilization issue as we're trying to figure out what code is causing the CPU to spin. First we got the PID of the Wildfly process ...
[myuser@prodmachine ~]$ ps -elf | grep java
0 S jboss 1992 1 0 80 0 - 28275 - Aug30 ? 00:00:00 /bin/sh /usr/java/wildfly/bin/standalone.sh -c standalone.xml
0 S jboss 2044 1992 45 80 0 - 7336044 - Aug30 ? 5-13:38:33 /usr/java/default/bin/java -D[Standalone] -server -Xms64m -Xmx25600m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=1024m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman,com.newrelic -java.awt.headless=true -javaagent:/usr/java/wildfly/newrelic/newrelic.jar -Dorg.jboss.boot.log.file=/usr/java/wildfly/standalone/log/server.log -Dlogging.configuration=file:/usr/java/wildfly/standalone/configuration/logging.properties -jar /usr/java/wildfly/jboss-modules.jar -mp /usr/java/wildfly/modules org.jboss.as.standalone -Djboss.home.dir=/usr/java/wildfly -Djboss.server.base.dir=/usr/java/wildfly/standalone -c standalone.xml
0 S 602 3630 1884 0 80 0 - 27617 pipe_w 14:19 pts/1 00:00:00 grep --color=auto java
However when I run the jstack
command, I get this strange error:
[myuser@prodmachine ~]$ sudo /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-8.b13.39.39.amzn1.x86_64/bin/jstack -F 1992
[sudo] password for myuser:
Attaching to process ID 1992, please wait...
Error attaching to process: Doesn't appear to be a HotSpot VM (could not find symbol "gHotSpotVMTypes" in remote process)
sun.jvm.hotspot.debugger.DebuggerException: Doesn't appear to be a HotSpot VM (could not find symbol "gHotSpotVMTypes" in remote process)
at sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:411)
at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:305)
at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:185)
at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
at sun.jvm.hotspot.tools.JStack.main(JStack.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.tools.jstack.JStack.runJStackTool(JStack.java:140)
at sun.tools.jstack.JStack.main(JStack.java:106)
I can't believe there's no SO post about this. Anyhow not sure what's going on and appreciate feedback.
First off I believe you were running the jstack
with the wrong PID - it should be the one for the java process. So instead of PID 1992, you should try:
sudo jstack 2044
That said, I also ran into this issue, even when specifying the correct PID. The stack trace / heap dump failed when running the commands as the root user. Changing the current user to the one that owns the process worked!
Try running:
sudo su - jboss
jstack 2044
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With