[jboss-user] [Beginners Corner] - Nervous Newbie Contemplates Growing Pile of Threads

pinkushn do-not-reply at jboss.com
Wed Dec 17 00:47:34 EST 2008

I am an ejb/Jboss newbie with an app that runs on a JBoss server.  Clients communicate with the server app using both jms and rmi.  

I was debugging on the server side today (using eclipse) when I noticed that a client sending a message to a queue on the server caused odd thread behaviors: a group of several new threads suddenly appeared on the server, all 'waiting.'  As the client sent more messages, more threads appeared, 'waiting'.  Why are they waiting?  The MDB that handles the messages only needs one thread, which should finish executing rapidly.  When I tested with three clients, each sending messages every five seconds, I reached more than 20 new threads before a sort of 'equilibrium' was reached, with old threads disappearing as new threads appeared.

Am I doing something wrong?  Could I be inadvertently acquiring a lock that is blocking these surplus threads from expiring?  Is there some way to avoid such a rapid accumulation of threads per client message?  I hope to someday have hundreds of clients, all sending messages every few seconds, and it seems that so many threads could lead to memory and performance issues.

The thread names include 'WorkManager' or 'JMSThread'  Here is a sample WorkManager stack as it waits:

Thread: WorkManager(2)-15 : priority:5, demon:true, threadId:138, threadState:TIMED_WAITING, lockName:java.lang.Object at 9fbd73

    java.lang.Object.wait(Native Method)

Thanks in advance for any pointers!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4197029#4197029

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4197029

More information about the jboss-user mailing list