2 Replies Latest reply on Nov 2, 2012 11:51 AM by Bhaskar Ethirajulu

    Thread leakage in long run in JMS remote messaging

    Bhaskar Ethirajulu Newbie



      Our application has around 10 Java modules. We are using JBOSS App server and JMS messaging for synchronous and asynchronous intercommunication between these modules.

      The thread threshold we maintained for our application is 600. But when we do longrun on the application for 2 to 3 days without doing any stress test the thread count has been slowly increasing to more than 1000. The order of thread leakage is unpredictable.


      When we run Jstack on the bin location of jdk path we are able to see around 450 threads which are alive and occured during JMS messaging. Please find below the origination of the thread messge.


      Please find below the thread origination messages.


      Thread 29704: (state = IN_NATIVE)

      - java.net.SocketInputStream.socketRead0(java.io.FileDescriptor, byte[], int, int, int) @bci=0 (Interpreted frame)

      - java.net.SocketInputStream.read(byte[], int, int) @bci=84, line=129 (Interpreted frame)

      - java.net.SocketInputStream.read() @bci=23, line=182 (Interpreted frame)

      - java.io.FilterInputStream.read() @bci=4, line=66 (Compiled frame)

      -  org.jboss.remoting.transport.bisocket.BisocketServerInvoker$ControlConnectionThread.run() @bci=18, line=741 (Interpreted frame)


      Can any one please respond quickly on this. This has to be fixed before moving it to production.




        • 1. Re: Thread leakage in long run in JMS remote messaging
          Ron Sigal Master

          Hi Bhaskar,


          Are you still having this problem?


          A ControlConnectionThread lives on the client side of a Remoting/JBossMessaging connection, and it monitors the bisocket control thread for requests from the server to create sockets.  One is created per connection, and, if you have pinging turned on for the control connection (which isn't the default in most or all versions of JBossMessaging), a new one will be created if the pinging times out, in which case the old one will be shut down.  Are you creating a lot of JMS connections at once, or accidentally leaving them open?



          • 2. Re: Thread leakage in long run in JMS remote messaging
            Bhaskar Ethirajulu Newbie

            Hi Ron,


            As you said in a particular negative scenario one of the JMS connection was opened and never closed. This leaded to increase in the thread leakage which ultimately leaded to increase in thread count in JBOSS and particular Java application where we had spawned these connections. We had fixed this issue two weeks later by running the trail version of JProfiler in remote mode. We found a thread count increase rapidly in the Jprofiler GUI and we caught the place where the thread leakage was happening


            Thanks and Regards,