httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <>
Subject win32: reason for inactive service taking 60s to shutdown
Date Tue, 30 Dec 1997 07:48:40 GMT
I like the windows manual:

  Note SIGINT is not supported for any Win32 application including Windows
  NT and Windows 95. When a CTRL+C interrupt occurs, Win32 operating systems
  generate a new thread to specifically handle that interrupt. This can
  cause a single-thread application such as UNIX, to become multithreaded,
  resulting in unexpected behavior. 

I wasn't aware UNIX was a single-thread application.

Anyway, about the reason why Apache takes 60 seconds to terminate
as a service if no requests come in.  The problem is that the child
blocks in select() and doesn't get around to the event until the
next time around the loop.

I couldn't find anything in the Windows API to easily let us 
deliver something to the app that will abort the select() early,
nor could I figure out anything that will let us wait for either
at the same time; the winsock functions are seperete from the
WaitForSingleObject type calls.  

Without completely rewriting the way this stuff is done (erm... 
another thread I guess or a different way of delivering the 
notification that it should shutdown) I can't see any obvious
way to do this right, so the below patch bumps down the timeout
on select().  It should make zero difference on a server that
gets at least a hit every 10 seconds and should cut the shutdown
time to 10 seconds.  Minor increase in overhead on an unused 

I wouldn't be suprised if there is a better way, I don't do Windows.

Index: http_main.c
RCS file: /export/home/cvs/apachen/src/main/http_main.c,v
retrieving revision 1.260
diff -u -r1.260 http_main.c
--- http_main.c	1997/12/26 18:16:17	1.260
+++ http_main.c	1997/12/30 07:37:32
@@ -3980,7 +3980,7 @@
     time_t end_time;
     int i;
     struct timeval tv;
-    int wait_time = 100;
+    int wait_time = 10;	/* XXXX bogus constant */
     int start_exit = 0;
     int count_down = 0;
     int start_mutex_released = 0;

View raw message