httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "" <>
Subject R: Re: graceful child process exit
Date Tue, 22 Sep 2015 12:43:10 GMT

>----Messaggio originale----
>Data: 21-set-2015 9.22

>Ogg: Re: graceful child process exit
>On 2015-09-21 00:45, Massimo 
Manghi wrote:
>Have a look at apr_pool_cleanup_register.
>I don't have 
pleasant memories with process pools. The problem is that 
>sometimes apache 
children take a long time to exit. When this happens 
>then the parent sends 
them signals in order to stop them, the signals 
>becoming progressively 
stronger (first sigterm, then sigkill if I 
>remember correctly). I do not 
remember the details, but I've been 
>getting segfaults at process exit, so I'm 
steering clear of process 
>pools since.
>Have a look if the conf pool is 
what you'd need. It is cleaned up every 
>time the apache configuration is 
reloaded (the parent apache process 
>stays alive, the apache worker children 
are stopped and a new generation 
>of apache children is created). You can use 
the second callback of the 
>apr_pool_cleanup_register to clean up things in 
the children.
>The difference between the conf pool and the process pool is 
>following: the process pool is passed to the post_config and child_init 

>callbacks. The conf pool is not passed to child_init. So, in order to 

>initialise things in the conf_pool you'll need to set a callback in the 

>post_config hook. The post_config hook is executed as root in the parent 

>process, before it forks a new generation of children, every time the 
configuration is reread (after each apache2ctl graceful). The 
>child_init hook 
is executed in the apache child every time the child 
>process is created and 
it executes without root privileges.

Thank you Sorin for the 
answer, sorry I'm at a conference and I can't answer with my 
identity. I don't think this message will get to the list unless someone will 
be so kind and gentle to approve it after it has been moderated.

The problem 
is that we have to implement a way to safely call 'exit' ourselves the way the 
procedures clean_child_exit does from within the MPM module. These procedures 
slightly differ between prefork and worker MPM and are private to the code of 
the MPM, so does a public API exists for that? 

clean_child_exit destroys the 
pChild pool in the first place and this in turn runs our cleanup procedure (we 
already have one set up) but it does other stuff that I imagine are vital for 
the web server ecosistem.
 -- Massimo

View raw message