0

I am trying to track down a memory leak that I am having with a Grails application and am using the Yourkit Profiler, but am running into a problem.

I have the Grails application running in Tomcat6 on the Production server and have unpacked the YourKit profiler and ran it according to the documentation using sudo bin/yjp.sh -attach, but I am getting the error:

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.yourkit.Main$2.run(a:19)
Caused by: com.yourkit.runtime.PresentableException: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded
    at com.yourkit.ui.s.n.a(a:170)
    at com.yourkit.ui.s.n.a(a:176)
    at com.yourkit.ui.s.j.a(a:250)
    at com.yourkit.c.do(a:73)
    at com.yourkit.Main0.entry(a:274)
    ... 5 more

I am using YourKit v10 and am on an Ubuntu 11.04 server. Any ideas?

skaz
  • 21,962
  • 20
  • 69
  • 98
  • I assume you are running the Yourkit locally and your Tomcat is running on a remote Ubuntu. Does the Yourkit show the running `PID` and you able to select it before the error? – JoseK Sep 13 '11 at 09:29
  • @JoseK - I haven't even opened Yourkit locally yet. I am just trying to run the command line on the server. Yes, I can see the running PID and select it. This is when I get the exception. – skaz Sep 13 '11 at 21:35

2 Answers2

1

It looks like I had to run as the user running the container. Changing sudo bin/yjp.sh -attach to sudo -u tomcat6 bin/yjp.sh -attach worked.

skaz
  • 21,962
  • 20
  • 69
  • 98
0

You need to have the Attach API working before you can continue:

com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded

See the JVisualVM FAQ - their troubleshooting can be used here too.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
  • Sorry to be so annoying and ignorant. Can you point me in the right direction (in terms of a URL)? I am looking here http://visualvm.java.net/troubleshooting.html but do not see what I am looking for. Hell, I don't even really know what I am looking for. Also, is it possible that I need to run the profiler as the same user that is running the web app? Some people seemed to get the exception when this was the case. I tried running the profiler as the `tomcat6` user, but I don't know how to authenticate as that user. Thanks for your help. – skaz Sep 13 '11 at 22:03
  • Looks like it was the fact that I was running as the wrong user. I am still interested in your answer though. – skaz Sep 13 '11 at 22:40