# Signal process in nginx

**URL:** <https://www.ruby-forum.com/t/signal-process-in-nginx/215067>\
**Category:** NGINX\
**Created:** [December 21, 2011, 4:52am UTC](https://www.ruby-forum.com/t/signal-process-in-nginx/215067 "2011-12-21T04:52:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [December 21, 2011, 4:52am UTC](https://www.ruby-forum.com/t/signal-process-in-nginx/215067/1 "2011-12-21T04:52:47Z")

</div>

* * *

nginx mailing list  
removed\_email\_address@domain.invalid  
[http://mailman.nginx.org/mailman/listinfo/nginx](http://mailman.nginx.org/mailman/listinfo/nginx)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 21, 2011, 6:56am UTC](https://www.ruby-forum.com/t/signal-process-in-nginx/215067/2 "2011-12-21T06:56:00Z")

</div>

On Dec 20, 2011, at 10:51 PM, 한그루 wrote:

> 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.

writing out a new config file and doing a normal reload will accomplish  
the same thing and it’s already done. No need to reinvent the wheel, I  
don’t think. We manage the members of an upstream “dynamically” based  
on our CMDB, so when we add or remove servers, the changes are reflected  
in nginx and we did this without touching a line of nginx code.

–Brian

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 21, 2011, 11:16am UTC](https://www.ruby-forum.com/t/signal-process-in-nginx/215067/3 "2011-12-21T11:16:15Z")

</div>

Hello!

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

> ```
> 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:

> **[General Information](https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html)**

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 D.
