You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2002/08/16 01:45:36 UTC

DO NOT REPLY [Bug 11755] New: - Possible to hang new instance if old instance is not yet fully shut down

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11755>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11755

Possible to hang new instance if old instance is not yet fully shut down

           Summary: Possible to hang new instance if old instance is not yet
                    fully shut down
           Product: Tomcat 4
           Version: 4.0.4 Final
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: alex@apache.org


If one Tomcat process is in the process of shutting down, and another
Tomcat process is then launched from the same set of config files
(same control port) -- *before* the first one has fully shut down --
then it is possible to get in a state where the new Tomcat is
*partially* running, in a sort of undead state -- it is alive, yet
does not work, yet also prevents further Tomcat instances from
running.

This state is reflected in catalina.out by the error message

StandardServer.await: create[8005]: java.net.BindException: Address already in use
java.net.BindException: Address already in use
	at java.net.PlainSocketImpl.socketBind(Native Method)
	at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:405)
	at java.net.ServerSocket.<init>(ServerSocket.java:170)
	at org.apache.catalina.core.StandardServer.await(StandardServer.java:277)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:794)
	at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
	at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)

It seems to happen when the original instance has shut down its port
8005 listener, but has not yet closed its port 8080 listener, allowing
the second instance to grab 8005 yet fail to open 8080.  This, in
turn, keeps the third instance from launching at all.  (I may be wrong
about the order, but I have a feeling that the theme of the deadlock
is port socket listeners.)

In Linux this undead state is also signified by the "ps" utility
showing 10 Tomcat threads/processes, instead of the usual 30 or so.

The proper behavior is probably for the second Tomcat to either fail
gracefully and completely when it fails to establish all its
listeners, and/or to wait a moment and try again (perhaps up to a
minute, at which point it should fail completely).

Fixing this (along with the other two RFEs) is important for the implementation
of a restart script, which is a pretty useful thing for a sysadmin to have.

I have been off the Tomcat team for a while, but if a current developer wants to
point me in the right direction, please let me know and I'll see if I can take a
stab at writing a patch myself.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>