signal process in nginx

Maxim Dounin mdounin at
Wed Dec 21 10:15:22 UTC 2011


On Wed, Dec 21, 2011 at 12:51:58PM +0900, 한그루 wrote:

>                                    Hello.
>       I'm working on customizing of nginx to load backend server list
>                from shared memory instead of the config file.
>    My customer wants to manage the backend server list dynamically. so if
>      a administrator add or remove some backend servers a program will
>      write about it into shared memory and send signal to nginx worker
>          process to force to synchronize with current server list.
>     My question is (It's very hard to understand your code without kind
>             comments and i don't have enough time to analyze it)
>    Is it ok if nginx process signal as soon as it delivered? or is there
>              any critical section where i should block signal?

Possible processing within signal handlers is limited.

First of all, usual programming rules apply: you are free to use 
only functions which are marked as async-signal-safe in POSIX, 
they are listed here:

Use of nginx own functions is restricted to a subset of functions 
which only call async-signal-safe functions and don't use shared 
memory locking.  There is no list of "safe" functions, i.e. before 
using something in signal handler you have to carefully inspect it 
to make sure it's possible to use it in a signal handler.

Maxim Dounin

More information about the nginx mailing list