Merge of r4758: win32: fixed cpu hog after process startup failure.

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 Villalobos Guevara:
http://mailman.nginx.org/pipermail/nginx-devel/2012-July/002494.html
This commit is contained in:
Maxim Dounin 2012-08-06 16:24:22 +00:00
parent 09c6ff334e
commit 7ca2e6d24e

View File

@ -196,6 +196,7 @@ failed:
if (ngx_processes[s].handle) { if (ngx_processes[s].handle) {
ngx_close_handle(ngx_processes[s].handle); ngx_close_handle(ngx_processes[s].handle);
ngx_processes[s].handle = NULL;
} }
return NGX_INVALID_PID; return NGX_INVALID_PID;