4 Replies Latest reply on Jun 7, 2011 4:00 PM by baradon

    Shutdown of JBoss AS 5.1 sometimes hangs

    baradon

      Hi folks,

       

      we sometimes see, that a shutdown of JBoss AS 5.1 (via shutdown script) just hangs without any further log message.  I have the impression, that the reason is either an open network connection, or an open database connection, which is still not finished.

       

      Anyways, is there a possibility to shutdown the server even in those cases.  The only possibility we have so far is "kill -9" on the Java process.

       

      Is there a simple way to check, what could be the cause of the hanging?

       

       

      All the best,

       

       

          Heiner

        • 1. Re: Shutdown of JBoss AS 5.1 sometimes hangs
          peterj

          First, check the log to make sure that it received the shutdown signal. Second, when the shutdown appears to "hang", take a JVM thread dump. Usually the stack trace for one of the threads will give a clue as to what is causing the holdup. The JVM will not exit until all threads are teminated, so one of the htreads still running is the culprit.

          • 2. Re: Shutdown of JBoss AS 5.1 sometimes hangs
            baradon

            Hi Peter,

             

            well, I can do this in the lab, but I fear, it will not be possible to ask our customer to do such things on-site.  Nevertheless, I will try to investigate it further. (And:  Yes, the shutdown signal was received in all of those events.)

             

            But the main question remains:  Is there a way to tell the JVM to terminate completely, killing all of it's threads if they do not close properly?

             

             

            Heiner

            • 3. Re: Shutdown of JBoss AS 5.1 sometimes hangs
              peterj

              But the main question remains:  Is there a way to tell the JVM to terminate completely, killing all of it's threads if they do not close properly?

              Yes, but you found it already: kill -9

              I recommend you still run shutdown first and only use kill -9 if the shutdown doesn't happen. By doing this at least the threads that are not hung will have a chance to terminate.

              • 4. Re: Shutdown of JBoss AS 5.1 sometimes hangs
                baradon

                Okay, if this is the only way ...

                 

                We extended the init script.  It first runs a normal shutdown and waits some time.  If it detects a hanging server afterwards, it writes a thread dump to a file and goes for the heavy artillery .

                 

                All the best,

                 

                Heiner