RE: PATCH: jk_nt_service can't automatically be restarted by Windows Service Control Manager upon crash

2001-08-31 Thread Marc Saegesser

Costin,

Sure, I'll take care of it today.


Marc Saegesser 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Friday, August 31, 2001 12:13 AM
 To: [EMAIL PROTECTED]
 Subject: RE: PATCH: jk_nt_service can't automatically be restarted by
 Windows Service Control Manager upon crash
 
 
 On Thu, 30 Aug 2001, Marc Saegesser wrote:
 
  The patch looks good and seems to work OK after I configured my tomcat
  service to attempt restarts on failures.  I hacked Tomcat to 
 croak on start
  up and the SCM correctly attempted a single restart and then quit.
 
 Hi Marc,
 
 Could you check it in the main branch too ?
 
 Costin



RE: PATCH: jk_nt_service can't automatically be restarted by Windows Service Control Manager upon crash

2001-08-31 Thread Brian Enright

Way to go Dave!

-Original Message-
From: Marc Saegesser [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 10:26 PM
To: [EMAIL PROTECTED]
Cc: Chien-Ming Huang; Brian Enright; Rob Webb; Patti Vrobel; Steven
Velez
Subject: RE: PATCH: jk_nt_service can't automatically be restarted by
Windows Service Control Manager upon crash


The patch looks good and seems to work OK after I configured my tomcat
service to attempt restarts on failures.  I hacked Tomcat to croak on start
up and the SCM correctly attempted a single restart and then quit.

The patch has been committed.  The native code doesn't get built for the
nightly builds so this won't show up in a distribution until Tomcat 3.2.4
(and I haven't worked out a schedule for that yet).


Marc Saegesser

 -Original Message-
 From: Dave Ringoen [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 4:55 PM
 To: '[EMAIL PROTECTED]'
 Cc: Chien-Ming Huang; Brian Enright; Rob Webb; Patti Vrobel; Steven
 Velez
 Subject: PATCH: jk_nt_service can't automatically be restarted by
 Windows Service Control Manager upon crash


 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_servic
 e.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:
  /*




RE: PATCH: jk_nt_service can't automatically be restarted by Windows Service Control Manager upon crash

2001-08-30 Thread Schreibman, David

If you really want the service code to be aggressive about restarting
Tomcat, I would suggest just calling start_tomcat() again.  This would avoid
any dependency on the Service Control Manager's reaction to ungraceful
exits.  In fact, I've never seen any documentation from Microsoft about such
restarts.  The only automatic service startups that I know about are upon
booting.  Can you send a reference to MS documentation about this?

In addition, I don't think you would want this to just keep restarting
indefinitely.  If the vm is crashing a lot then there's something going on
that needs to be looked at.  Such restart functionality should be limited to
a certain number of retries.  Continuing to run the vm might interfere with
other software running on the same machine.  Especially if the vm is
crashing due to some unusual resource consumption.

Just my 2 bits worth.

-David


-Original Message-
From: Dave Ringoen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 2:55 PM
To: '[EMAIL PROTECTED]'
Cc: Chien-Ming Huang; Brian Enright; Rob Webb; Patti Vrobel; Steven
Velez
Subject: PATCH: jk_nt_service can't automatically be restarted by
Windows Service Control Manager upon crash


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:
 /* 



RE: PATCH: jk_nt_service can't automatically be restarted by Windows Service Control Manager upon crash

2001-08-30 Thread Marc Saegesser

The patch looks good and seems to work OK after I configured my tomcat
service to attempt restarts on failures.  I hacked Tomcat to croak on start
up and the SCM correctly attempted a single restart and then quit.

The patch has been committed.  The native code doesn't get built for the
nightly builds so this won't show up in a distribution until Tomcat 3.2.4
(and I haven't worked out a schedule for that yet).


Marc Saegesser

 -Original Message-
 From: Dave Ringoen [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 4:55 PM
 To: '[EMAIL PROTECTED]'
 Cc: Chien-Ming Huang; Brian Enright; Rob Webb; Patti Vrobel; Steven
 Velez
 Subject: PATCH: jk_nt_service can't automatically be restarted by
 Windows Service Control Manager upon crash


 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_servic
 e.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:
  /*





RE: PATCH: jk_nt_service can't automatically be restarted by Windows Service Control Manager upon crash

2001-08-30 Thread Marc Saegesser

As of Win2000 (not sure if this existed in WinNT) you can configure a
service to attempt to recover if it dies.  This is fairly flexible in that
you can cause it to attempt up to three restarts (after a delay period),
execute a file on failure, reboot the system, etc.

We might as well use the facilities the OS provides instead of duplicating
this inside the service.


Marc Saegesser

 -Original Message-
 From: Schreibman, David [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 6:06 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: PATCH: jk_nt_service can't automatically be restarted by
 Windows Service Control Manager upon crash


 If you really want the service code to be aggressive about restarting
 Tomcat, I would suggest just calling start_tomcat() again.  This
 would avoid
 any dependency on the Service Control Manager's reaction to ungraceful
 exits.  In fact, I've never seen any documentation from Microsoft
 about such
 restarts.  The only automatic service startups that I know about are upon
 booting.  Can you send a reference to MS documentation about this?

 In addition, I don't think you would want this to just keep restarting
 indefinitely.  If the vm is crashing a lot then there's something going on
 that needs to be looked at.  Such restart functionality should be
 limited to
 a certain number of retries.  Continuing to run the vm might
 interfere with
 other software running on the same machine.  Especially if the vm is
 crashing due to some unusual resource consumption.

 Just my 2 bits worth.

 -David


 -Original Message-
 From: Dave Ringoen [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 2:55 PM
 To: '[EMAIL PROTECTED]'
 Cc: Chien-Ming Huang; Brian Enright; Rob Webb; Patti Vrobel; Steven
 Velez
 Subject: PATCH: jk_nt_service can't automatically be restarted by
 Windows Service Control Manager upon crash


 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:
  /*




RE: PATCH: jk_nt_service can't automatically be restarted by Windows Service Control Manager upon crash

2001-08-30 Thread Schreibman, David

I guess that was what I was trying to get at.  The failure restart
functionality was not available before Windows 2000.  Otherwise I totally
agree with taking full advantage of the OS.

Thanks,

-David


-Original Message-
From: Marc Saegesser [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 7:30 PM
To: [EMAIL PROTECTED]
Subject: RE: PATCH: jk_nt_service can't automatically be restarted by
Windows Service Control Manager upon crash


As of Win2000 (not sure if this existed in WinNT) you can configure a
service to attempt to recover if it dies.  This is fairly flexible in that
you can cause it to attempt up to three restarts (after a delay period),
execute a file on failure, reboot the system, etc.

We might as well use the facilities the OS provides instead of duplicating
this inside the service.


Marc Saegesser

 -Original Message-
 From: Schreibman, David [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 6:06 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: PATCH: jk_nt_service can't automatically be restarted by
 Windows Service Control Manager upon crash


 If you really want the service code to be aggressive about restarting
 Tomcat, I would suggest just calling start_tomcat() again.  This
 would avoid
 any dependency on the Service Control Manager's reaction to ungraceful
 exits.  In fact, I've never seen any documentation from Microsoft
 about such
 restarts.  The only automatic service startups that I know about are upon
 booting.  Can you send a reference to MS documentation about this?

 In addition, I don't think you would want this to just keep restarting
 indefinitely.  If the vm is crashing a lot then there's something going on
 that needs to be looked at.  Such restart functionality should be
 limited to
 a certain number of retries.  Continuing to run the vm might
 interfere with
 other software running on the same machine.  Especially if the vm is
 crashing due to some unusual resource consumption.

 Just my 2 bits worth.

 -David


 -Original Message-
 From: Dave Ringoen [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 2:55 PM
 To: '[EMAIL PROTECTED]'
 Cc: Chien-Ming Huang; Brian Enright; Rob Webb; Patti Vrobel; Steven
 Velez
 Subject: PATCH: jk_nt_service can't automatically be restarted by
 Windows Service Control Manager upon crash


 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:
  /*