Error: 304. Apparent bug in 3.3a ErrorHandler code
Hello, I just stumbled upon a show-stopper problem with Tomcat 3.3a and Apache mod_jk. When refreshing JSPs that referenced static resources (i.e. a CSS stylesheet or images), from time to time junk would appear at the top of the page, saying Error: 304... Location: page address. The said static resources would not load and the browser would appear to hang indefinitely. I tracked the problem to the method StatusHandler.doService defined in share/org/apache/tomcat/modules/generators/ErrorHandler.java When the 304 (Not Modified) condition is encountered, this method generates a message body with the above mentioned junk and returns it to mod_jk. RFC 2068 states: If the client has performed a conditional GET request and access is allowed, but the document has not been modified, the server SHOULD respond with this status code. The response MUST NOT contain a message-body. Replacing Tomcat's vanilla ErrorHandler with my own clone with the whole message body generating block omitted if sc == 304 eliminated the problem. Interestingly, the bug could only be demonstrated with mod_jk + Tomcat, but not when I was using Tomcat alone as a web server. Can anyone confirm the above observations? If I am correct, what is the official procedure to submit bug reports and fixes? Take care - JPL -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Internal Server Errors while/after restarting Tomcat with mod_jk
Hi, I have two questions regarding mod_jk's way of dealing with Tomcat going away. (1) Can mod_jk be extended safely to retry connecting for a certain time instead of immediately reporting an Internal Server Error if a Tomcat process is temporarily unavailable? I have modified the function jk_open_socket to do just that (keep trying for a minute in 2 second intervals before giving up). However, I am not sure if this is the correct place and whether it would have negative side effects in some configurations (for example, I can imagine that in a clustered setup, mod_jk should not wait for Tomcat to recover, but fail over to another instance). Any ideas whether this feature could be made optional or what a better place to implement it would be? The purpose of all that is to make Tomcat restarts (which are inevitable, as we develop our applications; automatic class reloading doesn't always do the trick) transparent to the web server. (2) I observed that stopping and restarting Tomcat while Apache with mod_jk is running results in Internal Server Errors starting to appear randomly in further requests. I guess that this is caused by mod_jk trying to use a now dead Tomcat instance to service a request. However, I looked into mod_jk code (jk_ajp13_worker.c) and it seems that it should attempt reconnecting if it detects a bad socket. Perhaps it ought to also remove the worker from its pool and fail over to the next available one instead of spitting out an Internal Server Error. I am not sure because I don't know how workers announce their presence to mod_jk and have not found any tech docs for mod_jk besides of install/configuration issues. Here is a snippet from the log illustrating what happens: [jk_uri_worker_map.c (344)]: Into jk_uri_worker_map_t::map_uri_to_worker [jk_uri_worker_map.c (406)]: jk_uri_worker_map_t::map_uri_to_worker, Found a match ajp13 [jk_worker.c (123)]: Into wc_get_worker_for_name ajp13 [jk_worker.c (127)]: wc_get_worker_for_name, done found a worker [jk_ajp13_worker.c (651)]: Into jk_worker_t::get_endpoint [jk_ajp13_worker.c (536)]: Into jk_endpoint_t::service [jk_ajp13.c (346)]: Into ajp13_marshal_into_msgb [jk_ajp13.c (480)]: ajp13_marshal_into_msgb - Done [jk_ajp13_worker.c (606)]: Error sending request body [jk_ajp13_worker.c (489)]: Into jk_endpoint_t::done Can someone confirm that restarting a Tomcat worker is unsupported by mod_jk and will lead to problems? If so, could someone knowledgeable in this code advise how to work around this problem or whether it would be a major effort to implement a transparent failover? It seems silly to restart Apache every time (one of) Tomcats needs to be reinitialized, just for mod_jk's sake. Thanks in advance for any hints. -JPL