Hi!
It would seem that the Jakarta NT Service fails to properly shutdown Tomcat.
Examining the code shows that it does the right thing and sends the ajp1[23]
shutdown message but then happily proceeds to terminate the Tomcat process
before it has a chance to shutdown gracefully. Oops!
The patch to fix it is below. This patch also includes a fix to the .dsp
file, required by the mod_jk reorganisation.
Enjoy!
Luke
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.1
diff -u -r1.1 jk_nt_service.c
--- jk_nt_service.c 2000/08/26 02:03:53 1.1
+++ jk_nt_service.c 2000/10/25 04:19:10
@@ -639,9 +639,10 @@
static void stop_tomcat(short port,
const char *protocol,
HANDLE hTomcat)
-{
+{
+
struct sockaddr_in in;
-
+
if(jk_resolve("localhost", port, &in)) {
int sd = jk_open_socket(&in, JK_TRUE, NULL);
if(sd >0) {
@@ -659,7 +660,7 @@
rc = ajp13_marshal_shutdown_into_msgb(msg,
&pool,
NULL);
- if(rc) {
+ if (JK_TRUE == rc) {
jk_b_end(msg);
if(0 > jk_tcp_socket_sendfull(sd,
@@ -670,13 +671,13 @@
}
} else {
char b[] = {(char)254, (char)15};
- int rc = send(sd, b, 2, 0);
- if(2 == rc) {
+ if(2 == send(sd, b, 2, 0)) {
rc = JK_TRUE;
}
}
jk_close_socket(sd);
- if(2 == rc) {
+ if(JK_TRUE == rc) {
+ // shutdown message sent - give it a moment to finish.
if(WAIT_OBJECT_0 == WaitForSingleObject(hTomcat, 30*1000))
{
return;
}
Index: nt_service.dsp
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/native/mod_jk/nt_service/nt_service.dsp,v
retrieving revision 1.1
diff -u -r1.1 nt_service.dsp
--- nt_service.dsp 2000/08/26 02:03:53 1.1
+++ nt_service.dsp 2000/10/25 04:19:10
@@ -42,7 +42,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D
"_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../jk" /D "WIN32" /D "NDEBUG" /D
"_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "../common" /D "WIN32" /D "NDEBUG" /D
"_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@@ -66,7 +66,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D
"_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../jk" /D "WIN32" /D "_DEBUG" /D
"_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../common" /D "WIN32" /D "_DEBUG"
/D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]