I got a Java web-application here running on Tomcat6 with Ubuntu (server edition). After 1-3 days, the application becomes very slow, so I created a threaddump after a fresh restart of tomcat and another one when the application starts to become slow:
Threaddump after fresh restart:
- via pkill -3: http://dl.dropbox.com/u/17844821/zeug/pkill-threaddump-fresh.out
- via jstack: http://dl.dropbox.com/u/17844821/zeug/jstack-threaddump-fresh.txt
Threaddump after 3 days (application is slow now):
- via pkill -3: http://dl.dropbox.com/u/17844821/zeug/pkill-threaddump.txt
- via jstack: http://dl.dropbox.com/u/17844821/zeug/jstack-threaddump.txt
From the dumps I posted, I can see that there are a lot of threads which do not seem to terminate for some reason. Unfortunately, I cannot tell which ones (class names?) and why. Using top
on the console showed that the value for "VIRT" went up from ~800 (after fresh restart) to more than 4000 (after 3 days).
How can I interpret these dumps better? I already tried to load them into TDA but that didn't work (TDA doesn't seem to recognize them as dumps).
Maybe someone already sees in the dumps what's going on?
In the jstack text file, I see numerous threads hanging in BCI (Byte-Code Interpreter), probably interpreting your code. It does not seem to indicate where in your code it is interpreting.
It does say you have a deadlock condition.
In the .out file, I looked for what looks like application code. I see it hanging at
EventProcessingThreadImpl.run:479 (2 threads)
GC.java:100 (1 thread) in GC waiting for something to be released so that GC can proceed.
Many threads parked in an unsafe condition, holding for a synchronizer, trying to read a job queue, in ThreadPoolExecutor.java:907
I also see what looks like a lot of boilerplate - threads waiting to be given work to do, threads runnable, waiting for mail, etc.
Is this of any help?
Added:
OK, I searched for your code and found it on three threads, shown here, and beneath each one I've given a tentative explanation.
(Also, note this link about using jstack to find deadlocks.)
Thread 20607 is in com.smampi.web.view.client.ClientController$5.onEvent line 128 (I'm guessing). It is displaying a modal message box and waiting for it to be answered.
Thread 20878 is also displaying a message box, but at line 417 (I'm guessing)
Thread 22792 is trying to do a mail service connect from com.smampi.web.model.mail.server.MailServer.connect line 514, and that's being called from com.smampi.web.model.mail.server.MailServer$1.closed at line 593. To do that, it looks like it's waiting for another thread to stop garbage collecting so it can allocate memory for a new thread so it can do a "startTLS" (for upgrading a plain text link to an encrypted one) so it can do a mail service connect.
Does that shed any light?