Possible cause and solution of 100% cpu and massive log file in Windows

Maxim Dounin mdounin at mdounin.ru
Mon Jul 23 16:34:41 UTC 2012


Hello!

On Wed, Jul 18, 2012 at 04:24:30PM -0400, Ricardo V G wrote:

> Recently one of my employer's products (Trend Micro) that includes
> nginx Windows binary had an issue similar to [1] where the error
> message "[alert] 2548#2552: WaitForMultipleObjects() failed (6: The
> handle is invalid)" is generated indefinitely hence creating a massive
> log file. This wasn't new. Previously a change was done to the
> configuration and it seemed that the issue was fixed. But it
> reappeared and I was asked to look into it. Here's what I think could
> be the problem along with the solution (patch) at the end of this
> email.
> 
> When creating threads in a Windows system the following calls are made
> (using release 1.2.2):
> 
> main() ->
>     ngx_master_process_cycle() ->
>         ngx_start_worker_processes() ->
>             ngx_start_worker_processes() ->
>                 ngx_spawn_process()
> 
> The issue appears in one documented case when
> ngx_start_worker_processes() fails to create a thread and the
> following error message is generated:
> 
>     [alert] 2548#2552: the event "ngx_master_2548" was not signaled for 5s
> 
> When this message is generated, the execution jumps to the failed
> label using a goto in os/win32/ngx_process.c at line 150. From there
> on, the function attempts to close all opened handles and returns an
> error in the form of an invalid process/thread ID. It's important to
> note that the thread handle is closed if necessary but the global
> variable that holds it is not cleared (i.e. the global array
> ngx_processes[] defined in os/win32/ngx_process.c at line 17 keeps all
> handles).

[...]

Good catch, thanks.  I've committed a slightly modified version 
of your patch.

Could you please provide your full name for CHANGES?

Maxim Dounin



More information about the nginx-devel mailing list