]> git.kaiwu.me - nginx.git/commitdiff
Win32: fixed cpu hog after process startup failure.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 23 Jul 2012 16:37:24 +0000 (16:37 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 23 Jul 2012 16:37:24 +0000 (16:37 +0000)
If ngx_spawn_process() failed while starting a process, the process
handle was closed but left non-NULL in the ngx_processes[] array.
The handle later was used in WaitForMultipleObjects() (if there
were multiple worker processes configured and at least one worker
process was started successfully), resulting in infinite loop.

Reported by Ricardo V G:
http://mailman.nginx.org/pipermail/nginx-devel/2012-July/002494.html

src/os/win32/ngx_process.c

index 87e8f9a2aca5547ce85d02940a6c4393f2dd67d7..67c6b121a186429cbfc84e5a5b38cf9bf2c519a1 100644 (file)
@@ -196,6 +196,7 @@ failed:
 
     if (ngx_processes[s].handle) {
         ngx_close_handle(ngx_processes[s].handle);
+        ngx_processes[s].handle = NULL;
     }
 
     return NGX_INVALID_PID;