[Kamailio-Devel] [ openser-Patches-1720847 ] -D option: "do not daemonize", -F option: "do not fork"

SourceForge.net noreply at sourceforge.net
Tue Oct 28 14:40:56 CET 2008


Patches item #1720847, was opened at 2007-05-17 18:40
Message generated for change (Comment added) made by axlh
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=1720847&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: ver devel
Status: Closed
Resolution: Fixed
Priority: 9
Private: No
Submitted By: Anatoly Pidruchny (apidruchny)
Assigned to: Henning Westerholt (henningw)
Summary: -D option: "do not daemonize", -F option: "do not fork"

Initial Comment:
This is an improved patch 1689998. The issue with the original patch was that sometimes the grand-children of the main openser process stayed alive when the main openser process and its children terminated. The improvement is that now the main openser process creates a new process group even when "do not daemonize" option is used. This will allow the main openser process to send signals to the whole process group and that means that grandchildren will also receive signals from the main process and will also terminate with the main openser process and its children. The original description of the patch follows.

This patch is to allow to run OpenSER in "no-daemon" mode. We need to do this to run OpenSER under daemontools. There is a -D option already that means "Do not fork into daemon mode". But the problem with this option is that it really means more then just "Do not fork into daemon mode". It really means do not fork at all, i.e. do not create any child OpenSER processes. The patch below adds a variable no_daemon in main.c, makes -D option only change the no_daemon variable and makes the variable no_daemon only control whether OpenSER daemonizes itself or not. Another option, option -F, is added as the replacement of the old -D option. The -F option sets both no_daemon and dont_fork variables, so that it means exactly the same as -D option meant before.

Anatoly Pidruchny
NewCross Technologies
email: apidruchny at newxt.com


----------------------------------------------------------------------

Comment By: Alex Hermann (axlh)
Date: 2008-10-28 14:40

Message:
The patch+followup patch changes the semantics of the 'fork' option.
Documentation states the default is 'yes'. But explicitly setting the
option to 'yes' in the script has different behavior than not specifying it
at all.
This makes the fork option a tristate rather than a boolean. This or the
documentation should be fixed (where I prefer the behavior to be fixed, as
it more intuitive).

current behavior:
fork=no -> daemon, not forked
fork=no + -D option -> foreground, not forked
fork=yes -> daemon, forked
fork=yes + -D option -> daemon, forked  ===> -D is ignored !!!
fork not mentioned + -D option -> foreground, forked


----------------------------------------------------------------------

Comment By: Henning Westerholt (henningw)
Date: 2008-08-25 13:44

Message:
Logged In: YES 
user_id=337916
Originator: NO

Hi Anatoly,

thanks for the patch, i ported it to current trunk, add a missing
definition for the getopt function and applied it. Please reopen this patch
or open a new bug report if you encounter any issues.

Cheers,

Henning

----------------------------------------------------------------------

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2007-07-19 17:00

Message:
Logged In: YES 
user_id=1275325
Originator: NO

Hi Anatoly,

looks good- I will start working on integrating it.

Regards,
Bogdan

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=1720847&group_id=139143



More information about the Devel mailing list