Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VisualVM connect to local TomEE very slow and can not take a heap dump

I encountered a very strange problem with TomEE 1.5.1 and VisualVM 1.7.0_09 on MAC OSX mountain lion.

After TomEE loaded some webapp.Use VisualVM connect local TomEE process take long time, and after connected the gc button is disabled and I can not take a heap dump. the VisualVM' log show some error.

com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded
    at sun.tools.attach.BsdVirtualMachine.<init>(BsdVirtualMachine.java:90)
    at sun.tools.attach.BsdAttachProvider.attachVirtualMachine(BsdAttachProvider.java:63)
    at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:213)
    at com.sun.tools.visualvm.attach.AttachModelImpl.getVirtualMachine(AttachModelImpl.java:104)
Caused: java.io.IOException: Unable to open socket file: target process not responding or HotSpot VM not loaded

the .java_pid<pid> file not created in tmp folder.

But if I use VisualVM to connect TomEE after start it and before any webapps loaded, The .java_pid<pid> file will created, and VisualVM will connect to it immediately, and heap dump works.

Another workaround is modify catalina.sh to add tools.jar to the ClassPath and remove openejb javaagent, then connect after TomEE fully started works fine.

Can not reproduce on a ubuntu machine.

like image 751
Yaocl Avatar asked Dec 03 '12 07:12

Yaocl


People also ask

Where does VisualVM store heap dump?

Heap dumps are displayed in the heap dump sub-tab in the main window. You can open binary format heap dump files (. hprof) saved on your local system or use Java VisualVM to take heap dumps of running applications.

How add JMX connection to VisualVM?

Right-click on the left panel and select Add JMX Connection: Input the host:port combination in the Connection field in the resulting dialog box and click OK.


1 Answers

Probably jvm is running out of memory. I've seen it many times. Try:

  1. increasing memory limits.
  2. Connect VisualVM to jvm.
  3. Deploy your application.
  4. And run memory sampler, profiler or heap dump to diagnose the issue. You probably have memory leaks. Heap dump is the safest way to go if you have memory issues. You can also take heap dump using command line and analyze it in VisualVM later.

Also make sure your system is not running out of memory.

like image 74
NiematojakTomasz Avatar answered Oct 20 '22 01:10

NiematojakTomasz