tags:

views:

482

answers:

3

I'm running JBoss 5. I see that memory keep is increasing as time pass. The number of active threads are increasing. The following stacktrace is taken from an active thread which is one of many threads (These are the threads that are being added as time pass). What can i learn from the stacktrace? How can I go deeper and have clearer view of what is going on?

Name: WorkManager(2)-92 State: WAITING on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@4e2e52 Total blocked: 1 Total waited: 1

Stack trace: sun.misc.Unsafe.park(Native Method) java.util.concurrent.locks.LockSupport.park(LockSupport.java:158) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1925) java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:358) java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:947) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) java.lang.Thread.run(Thread.java:619)

Thanks, Rod

+1  A: 

That thread looks like it's waiting for getTask(), ie it's just waiting for some work to do.

New threads will spawn as requests come in, you shouldn't worry about it unless there's a huge number of threads busy with actual work.

Memory usage will grow over time until the JVM decides to garbage collect some of it. If it keeps growing, and running GC from jconsole makes no difference, it's possible you have a memory leak. Finding leaks can be difficult, but you could use MAT to make it easier.

Martin
A: 

You will learn more from this by running the JConsole from JDK1.6 or JDK1.7 . The JConsole.exe in JDK1.5 is "old-school".

djangofan
A: 

I'd suggest that you start by profiling with jvisualvm. You'll get graphs over time of heap usage, threads, garbage collection, etc.

You can also take a heap dump with jmap, and then analyze with jhat or mat.

dstine