6 Replies Latest reply on Feb 6, 2004 2:31 AM by genman

    Constantly increasing thread count although closing all conn

    juergenschwarz

      Hi,

      we are using JBoss 3.2.2 on a Windows 2000 System with Sun JDK 1.4.2.
      We have the problem, that the threads inside the JBoss are increasing
      constantly. We have figured out that the problem lies in the JMS.
      What we do is following:
      1. Create a TopicConnection, TopicSession and a TopicSubscriber in a
      Java client application.
      The code looks like this:
      session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      subscriber = session.createSubscriber(myTopic);
      subscriber.setMessageListener(this);
      connection.start();

      2. Receive some messages

      3. Before closing the client, we close ALL JMS TopicSubscribers,
      TopicSessions an TopicConnections.
      The code looks like this:
      connection.stop();
      subscriber.setMessageListener(null);
      subscriber.close();
      session.close();
      connection.setExceptionListener(null);
      connection.close();


      When we open and close our client, we can see, that for each
      createSubscriber() call we have done in the client,
      the thread count in JBoss increased by one. This leads to a thread count
      of over 1000 after several days.
      Where is the problem ?

      Regards
      Juergen

        • 1. Re: Constantly increasing thread count although closing all
          damien

          Are you using the default Persistence Manager? There is a thread leak problem with the default hsql datasource. Search this forum for more info.

          If you are using the default, you should change it. Either use your own datasource, or one of the file-based PMs.

          • 2. Re: Constantly increasing thread count although closing all
            hosierdm

            Yes, we had this problem in production! We have switched to using an Oracle configuration for the JMS persistence and all is right with the world. Even if none of your messages are persisted, the hsqldb will cause problems. This is because at the end of the connection timeout period, the connections will be killed and recreated. With hsqldb, the old stuff is not cleaned up, so it just keeps increasing until you run out of resources. For us, this problem manifested itself in our JBoss instance running out of file descriptors (not closing old connections properly) on a Solaris machine.

            -David

            • 3. Re: Constantly increasing thread count although closing all
              juergenschwarz

              Hi,

              i replaced the default PersistenceManager with the file-based PM, but the problem with the increasing threads is still there.
              Anyone can help ?

              Juergen

              • 4. Re: Constantly increasing thread count although closing all

                Post a thread dump

                Regards,
                Adrian

                • 5. Re: Constantly increasing thread count although closing all
                  juergenschwarz

                  Hi,

                  here is the thread dump from the web console.
                  The strange thing is, that the first line says there are 311 threads,
                  but the list of threads does not contain this much threads.
                  Where is the rest ?

                  Total Threads: 311Total Thread Groups: 7Thread Group: system : max priority:10, demon:falseThread: Reference Handler : priority:10, demon:trueThread: Finalizer : priority:8, demon:trueThread: Signal Dispatcher : priority:10, demon:trueThread: AdapterThread : priority:10, demon:trueThread: CompilerThread0 : priority:10, demon:trueThread: CompilerThread1 : priority:10, demon:trueThread: RMI TCP Accept-1098 : priority:5, demon:trueThread: RMI Reaper : priority:5, demon:falseThread: GC Daemon : priority:2, demon:trueThread: RMI TCP Accept-4444 : priority:5, demon:trueThread: RMI TCP Accept-0 : priority:5, demon:trueThread: RMI LeaseChecker : priority:5, demon:trueThread Group: main : max priority:10, demon:falseThread: DestroyJavaVM : priority:5, demon:falseThread Group: jboss : max priority:10, demon:falseThread: Thread-0 : priority:5, demon:trueThread: ScannerThread : priority:5, demon:trueThread: Thread-2 : priority:5, demon:trueThread: Thread-3 : priority:5, demon:trueThread: Thread-4 : priority:5, demon:falseThread: Thread-5 : priority:5, demon:trueThread: Thread-6 : priority:5, demon:trueThread: Thread-7 : priority:5, demon:trueThread: Thread-8 : priority:5, demon:trueThread: MonitorRunnable : priority:5, demon:trueThread: Thread-10 : priority:5, demon:trueThread: Thread-11 : priority:5, demon:trueThread: Thread-12 : priority:5, demon:trueThread: Thread-13 : priority:5, demon:trueThread: MonitorRunnable : priority:5, demon:trueThread: StandardManager[/invoker] : priority:5, demon:trueThread: StandardManager[/jbossmq-httpil] : priority:5, demon:trueThread: Thread-15 : priority:5, demon:falseThread: Thread-16 : priority:5, demon:falseThread: Thread-17 : priority:5, demon:falseThread: Thread-18 : priority:5, demon:falseThread: JBossMQ Cache Reference Softner : priority:5, demon:trueThread: Thread-24 : priority:5, demon:trueThread: Thread-27 : priority:5, demon:falseThread: Thread-28 : priority:5, demon:trueThread: StandardManager[/jmx-console] : priority:5, demon:trueThread: Thread-29 : priority:5, demon:trueThread: StandardManager[/web-console] : priority:5, demon:trueThread: Thread-30 : priority:5, demon:trueThread: Connection Consumer for dest TOPIC.witron/control/sps581_toserver : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/sps582_toserver : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/sps583_toserver : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/sps584_toserver : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/sps585_toserver : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/sps586_toserver : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/plcstatusdemandschedule : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/anl150_toserver : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/anl250_toserver : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/anl350_toserver : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/anl450_toserver : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/anl086_toserver : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/anl087_toserver : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/anl108_toserver : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/nok : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/picking1 : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/picking2 : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/picking3 : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/picking4 : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/picking5 : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/picking6 : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/change : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/inventory1 : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/inventory2 : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/inventory3 : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/storerolloutschedule : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/changed/status : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/decorlineschedule : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/supplementstorelift1rolloutschedule : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/supplementstorelift2rolloutschedule : priority:5, demon:falseThread: Connection Consumer for dest TOPIC.witron/control/supplementstorelift3rolloutschedule : priority:5, demon:falseThread: StandardManager[/witron] : priority:5, demon:trueThread: Thread-62 : priority:5, demon:falseThread: Thread-63 : priority:5, demon:trueThread: Thread-64 : priority:5, demon:trueThread: Thread-176 : priority:5, demon:trueThread: JNP Server : priority:5, demon:falseThread Group: JBossMQ Server Threads : max priority:10, demon:falseThread: OIL Worker Server : priority:5, demon:falseThread: OIL2 Worker Server : priority:5, demon:falseThread: UILServerILService Accept Thread : priority:5, demon:falseThread: OIL Worker-0 : priority:5, demon:falseThread: Message Pushers-1 : priority:5, demon:trueThread: OIL Worker-1 : priority:5, demon:falseThread: OIL Worker-2 : priority:5, demon:falseThread: OIL Worker-3 : priority:5, demon:falseThread: OIL Worker-4 : priority:5, demon:falseThread: OIL Worker-5 : priority:5, demon:falseThread: OIL Worker-6 : priority:5, demon:falseThread: OIL Worker-7 : priority:5, demon:falseThread: OIL Worker-8 : priority:5, demon:falseThread: OIL Worker-9 : priority:5, demon:falseThread: OIL Worker-10 : priority:5, demon:falseThread: OIL Worker-11 : priority:5, demon:falseThread: OIL Worker-12 : priority:5, demon:falseThread: OIL Worker-13 : priority:5, demon:falseThread Group: JBossMQ Client Threads : max priority:10, demon:falseThread: OILClientILService-0 : priority:5, demon:trueThread: Connection Monitor Thread : priority:5, demon:trueThread: OILClientILService-1 : priority:5, demon:trueThread: OILClientILService-2 : priority:5, demon:trueThread: OILClientILService-3 : priority:5, demon:trueThread: OILClientILService-4 : priority:5, demon:trueThread: OILClientILService-5 : priority:5, demon:trueThread: OILClientILService-6 : priority:5, demon:trueThread: OILClientILService-7 : priority:5, demon:trueThread: OILClientILService-8 : priority:5, demon:trueThread: OILClientILService-9 : priority:5, demon:trueThread: OILClientILService-10 : priority:5, demon:trueThread: OILClientILService-11 : priority:5, demon:trueThread: OILClientILService-12 : priority:5, demon:trueThread: OILClientILService-13 : priority:5, demon:trueThread Group: ASF Session Pool Threads : max priority:10, demon:falseThread: Thread Pool Worker-0 : priority:5, demon:falseThread: Thread-65 : priority:5, demon:trueThread: IdleRemover : priority:5, demon:falseThread: Thread-67 : priority:5, demon:falseThread: Thread Pool Worker-1 : priority:5, demon:falseThread: Thread Pool Worker-2 : priority:5, demon:falseThread: Thread Pool Worker-6 : priority:5, demon:falseThread: Thread Pool Worker-24 : priority:5, demon:falseThread: Thread Pool Worker-128 : priority:5, demon:falseThread Group: RMI Runtime : max priority:10, demon:false

                  • 6. Re: Constantly increasing thread count although closing all
                    genman


                    The CVS version of JBoss (3.2) fixes a potential thread leak when many queues and topics are created. This was due to the scheduling/expiration thread being constructed but not start()ed.