Modules are initialized twice in single-process mode for Win32
|Reported by:||Kroward 1||Owned by:|
|uname -a:||Microsoft Windows [Version 6.1.7601]|
|nginx -V:||nginx/1.4.4 (official binary)|
There is feature of nginx to run Nginx as single process with 'master_process off'. Documentation says that this is for debug only, but it is very useful in Windows. In windows only one worker is possible, so using this option is acceptable I think.
Actually setting 'master_process off' solve the problem with shared memory on Windows 7+, and enables to use modules like 'limit_conn' which rely on shared pool. (Why this problem with shared memory exist at all if we run single process?)
The only problem that 'win32/ngx_process_cycle.c' initializes modules twice in this mode, one time in procedure ngx_single_process_cycle() and second time in ngx_worker_thread().
Because of this open file descriptors become doubled and select() fires messages to log:
[alert] 2780_2832: select ready != events: 1:2
Removing module initialization loop in ngx_single_process_cycle() fixes this issue.
P.S.: I am aware that running Nginx in Windows is bad, actually I run it on Linux in production ;)