[sr-dev] [tracker] Task changed: In daemonize mode parent process should exit with error (-1) if main process fails to start
sip-router
admin at sip-router.org
Mon Apr 19 12:58:59 CEST 2010
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has been changed. The changes are listed below. For full information about what has changed, visit the URL and click the History tab.
FS#66 - In daemonize mode parent process should exit with error (-1) if main process fails to start
User who did this: Iñaki Baz Castillo (ibc)
Summary: Kamailio/SIP-Router should return error (255) when cannot assign requested address even in fork mode -> In daemonize mode parent process should exit with error (-1) if main process fails to start
Task details edited:
-------
Hi, there is an issue which prevents SR/Kamailio to being managed by software as HeartBeat (which mostly relies on init script return codes):
Let's suppose we configure SR to work in daemonize mode and to bind into a wrong address (i.e. a virtual address which for some reason is down in the server). When running it an error would be logged:
ERROR:core:udp_init: bind(6, 0x813f414, 16) on 1.2.3.4: Cannot assign requested address
However the command returns 0. This is ugly as it would indicate that the server has started correctly while in fact it's not running.
This occurs because the sockets are initialized after daemonizing so the SR main process is forked before detecting such address error. Then the parent process (that we started by executing the command) knows nothing about the failure and just returns 0.
Ok, so how to improve it? I asked for the same feature for Unicorn http server (a very robust http server writen in Ruby which is used by Github along with other sites): http://unicorn.bogomips.org/
The author implemented this feature, and the same could be implemented in SR. The mechanism is as follows (very simple and robust):
* The parent process (launched from a controlling terminal or script) shares a pipe with the SR master process. The parent process reads in the pipe and the master process will write into it.
* The parent process will wait until the master process is ready before returning. It will listen into the pipe until it received data from the master process, or until the pipe is closed by the master process:
* If the master process determines the server can run (no errors) it will communicate it to the parent process via the shared pipe. Then the parent process exits with 0 (OK).
* If instead the master process fails to start (i.e. "Cannot assign requested address") it will close the shared pipe. The parent process would detect such error (as the 'read' function would exit with error) and then it would exit with -1 (error).
I will try to implement it by myself, but would prefer to hear your opinions first :)
-------
Percent Complete: 0% -> 50%
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=66
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
More information about the sr-dev
mailing list