Opened 11 years ago

Closed 11 years ago

#453 closed defect (fixed)

Modules are initialized twice in single-process mode for Win32

Reported by: Kroward 1 Owned by:
Priority: minor Milestone:
Component: nginx-core Version:
Keywords: Cc:
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 ;)

Change History (2)

comment:1 by Maxim Dounin <mdounin@…>, 11 years ago

In b7bf4671bb7b8c455cf54fd39c0f87b7e4fbc312/nginx:

Win32: fixed init_process without master process (ticket #453).

Init process callbacks are called by ngx_worker_thread(), there is no
need to call them in ngx_single_process_cycle().

comment:2 by Maxim Dounin, 11 years ago

Resolution: fixed
Status: newclosed

Fix committed, thank you for report.

Note: See TracTickets for help on using tickets.