Reputation: 6459
I have a server that occasionally hangs when it exits. The hang only occures about 1/10 or less of the time and so far we can't figure out a way to reliably recreate the issue. I've walked through my code and thought that I am closing all resources and killing my threads, but obviously some of the time I don't close right.
Can anyone suggest debugging tips to help me test this when I can't reliably recreate it? I've tried running JVisualVM once it goes down, but it doesn't help much other then showing me the sigterm threads are running still and everything is at 0% CPU, which I assume means a deadlock somewhere.
Upvotes: 4
Views: 732
Reputation: 91
When the process hangs you can send SIGQUIT (kill -3) to the process and it will generate a thread dump. The output goes to stderr so make sure that is being captured.
Upvotes: 2
Reputation: 8383
You could try using JConsole to monitor your server. You can visually monitor the memory, CPU usages and no of threads etc. It also can detect deadlocks if there are.
Upvotes: 2