Bug 48625

Summary: Server started in illegal state
Product: Tomcat 6 Reporter: Roman Tsirulnikov <romanvt>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 6.0.20   
Target Milestone: default   
Hardware: PC   
OS: All   

Description Roman Tsirulnikov 2010-01-26 08:30:09 UTC
Due to Catalina startup logic, server startup in illegal state is possible.
For expamle, the concurrent process takes the socket in use, because of sysadmin error, or something else.
We started server, the server ignored the socket binding error, startup succes,
but isn't working yet.
In my opinion, the "system errors" (sockets, filesystems,...etc) should
abort the startup process, to ensure the server was started in right state.
If server silently ignores the errors, the sysadmin can miss the error,
and production system can be broken.

Socket binding error example:
....
[2010-01-26 19:09:26] [main ERROR coyote.http11.Http11Protocol] - Error starting endpoint
java.net.BindException: Address already in use: JVM_Bind /0.0.0.0:8001
	at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:511)
	at org.apache.tomcat.util.net.JIoEndpoint.start(JIoEndpoint.java:526)
	at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:203)
....


See Catalina.java:585

    public void start() {
....
        if (server instanceof Lifecycle) {
            try {
                ((Lifecycle) server).start();
            } catch (LifecycleException e) {
                log.error("Catalina.start: ", e);
                // !!!! exception ignored !!!!!!, server continued to start in broken state
            }
        }
....
            log.info("Server startup in " + ((t2 - t1) / 1000000) + " ms");
}
Comment 1 Mark Thomas 2010-01-31 03:00:27 UTC
This was feature was implemented in Tomcat 7 some time ago. I have proposed back porting it to 6.0.x
Comment 2 Mark Thomas 2010-02-18 10:04:42 UTC
The patch has been applied to trunk and will be included in 6.0.25 onwards.