DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=29208>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=29208 start listening on port after everything has been initialized. [EMAIL PROTECTED] changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID | ------- Additional Comments From [EMAIL PROTECTED] 2004-05-26 14:42 ------- I'm sorry to reopen this, but this is a serious production issue for us. Let me try to explain this in more detail. The current behavior of Tomcat is to as follows: 1) create a socket and bind to a port. This puts the socket in listen mode. Please note that accept() is not called on this socket until step (3). The socket is listening, but it's not processing any requests. 2) Do a lot of initialization, some of which is under web application control via load-on-startup. I can't find anything in the servlet spec that says a load-on-startup servlet must finish init() quickly. In fact, the spec says "Initialization is provided so that a servlet can read persistent configuration data, initialize costly resources (such as JDBC APIbased connections), and perform other one-time activities." 3) Finally start accpeting incoming connections on the socket. Tomcat has no way of knowing how long step (2) will take. We have some servers that take 5 minutes to initialize and some servers that take 2 hours (that's not a typo). A listening socket that's not accepting will cause incoming connections to wait indefinitely (or until the *client* times out). The SO_TIMEOUT parameter to the server socket has no effect unless the socket is accepting. In other words, a listening socket that's not accepting is violating the "connectionTimeout" parameter of the Connector configuration. A listening socket that's not accepting causes all sorts of problems. For example, it makes it really difficult to monitor the status and health of the server. Monitoring the health of servers is obviously very important for a production system. It is used, for example, to make high availability server farms for load balancing. A good way of monitoring a server is to send a simple request and see if the expected answer is returned. If the socket is not open yet, the diagnosis is very simple: the server is down. If the socket is open and accepting, the expected result is relatively simple to check. If the socket is listening but not accepting, the health monitor will be confused: how long should it wait for the response? is the server down or initializing or just very busy? The proposed changes are fairly simple: do all initialization before binding to the port. Tomcat can then guarantee that a properly initialized application can respond in a timely manner to incoming requests. We've spent a lot of effort converting from a commercial J2EE server to Tomcat. It would be shame to have to go back because of this. Is there any downside to the proposal? Thanks Moh --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]