main conf created twice, only closed once?

Maxim Dounin mdounin at mdounin.ru
Mon Mar 14 13:47:50 UTC 2016


Hello!

On Mon, Mar 14, 2016 at 07:01:42AM -0400, ben5192 wrote:

> Hi,
> I have a problem with a module I'm writing. I need to do something in the
> main config after variables are read from the conf file, so I have put this
> in the post_conf function. Then I need do something when to it when the
> process is closed via 
> ./nginx -s reload
> this is in the exit_process function. What I would expect is that for each
> reload there is one new main conf, this is not the case ( see output below
> ). Two new main configs are created, then only one of them is 'seen' by the
> exit_process.
> 
> create main conf mainconf=0x9908e8
> post conf mainconf=0x9908e8
> --- reload happens
> create main conf mainconf=0xe508e8
> post conf mainconf=0xe508e8
> create main conf mainconf=0x993ef8
> post conf mainconf=0x993ef8
> exit mainconf=0x9908e8
> 
> So on reload, two new main configs are created, and the previous one is
> closed. This wouldn't be a problem, but every subsequent reload the same
> thing happens ( two are created, but only one of the previous two exited).
> 
> Anyone have any idea why this might happen?

Are you using nginx on Windows?  On Windows both master and worker 
processes read the configuration, as there is no fork().

Note well that the exit_process callback is called on worker 
process exit, but not on exit of other processes.  It's not 
expected to be balanced with configuration creation.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list