We're using Tomcat at our company with considerable success, but discovered
that if java.exe crashes for some reason, the Tomcat service won't restart
automatically.
I diagnosed the problem and came up with this discovery and a proposed fix.
jk_nt_service.exe exits too gracefully if the java.exe process dies,
notifying the Service Control Manager that it is shutting down. When Service
Control Manager receives the shutdown message, it does not restart the
service. It assumes that the service was supposed to be shut down.
This patch makes jk_nt_service exit more abruptly without notifying SCM.
With this patch, SCM will correctly initiate a restart of the Tomcat
service.
I couldn't file this in Bugzilla because Bugzilla was down.
Thanks for your consideration on this patch. I'm very impressed with the
Tomcat development approach and process.
Dave Ringoen
Alventive, Inc.
cvs diff -u jk_nt_service.c (in directory
C:\Temp\tomcatsrcnightly\jakarta-tomcat\src\native\mod_jk\nt_service)
Index: jk_nt_service.c
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/native/mod_jk/nt_service/jk_nt_service.c,
v
retrieving revision 1.3
diff -u -r1.3 jk_nt_service.c
--- jk_nt_service.c 2001/04/24 08:49:46 1.3
+++ jk_nt_service.c 2001/08/30 18:05:02
@@ -535,6 +535,11 @@
/*
* Tomcat died !!!
*/
+ CloseHandle(hServerStopEvent);
+ CloseHandle(hTomcat);
+ exit(0); // exit ungracefully so
+ // Service Control Manager
+ // will attempt a restart.
break;
default:
/*