Hello,

On 27.04.17 04:18, Cody Herzog wrote:
>
> Hello.
>
>  
>
> I'm running Kamailio 4.3.5 on Ubuntu Server 14.04.
>
>  
>
> I just started using the app_python module together with the OpenTok
> Python SDK, described here:
>
>  
>
> https://tokbox.com/developer/sdks/python/
>
>  
>
> My basic Python test script works fine, but when I add an import
> statement in the Python script to bring in a package from the OpenTok
> Python SDK, Kamailio terminates right after launch with the following
> log message:
>
>  
>
> "terminating due to SIGCHLD"
>
>  
>
> I was surprised to not find any extra log messages indicating which
> child process was causing the signal.
>
>  
>
> I hacked the code in the handle_sigs() function in main.c.c to NOT
> terminate in response to SIGCHLD, and was surprised to see that my
> Python script was working fine, and was able to properly use the
> OpenTok Python SDK.
>
>  
>
> I then started adding more debugging log statements and discovered
> that the call to waitpid() was returning 0, which apparently indicates
> that no child process has changed state.
>
>  
>
> It's very strange, because it seems that SIGCHLD is being sent and
> handled, but waitpid() is indicating that no child process has changed
> state.
>
>  
>
> I'm not sure if that is valid situation which needs to be handled.
> Perhaps SIGCHLD is sometimes sent for spurious or harmless reasons
> which should be ignored, and not result in total Kamailio termination.
>
>  
>
> My current workaround is to NOT terminate when SIGCHLD is received and
> waitpid() indicates that no child process has changed state. In other
> words, I only terminate when the waitpid() while() loop has been
> entered at least once due to a return value greater than 0.
>
>  
>
> Does that seem like a change that might make sense in the master
> branch going forward, or does it seem dangerous somehow?
>
>  
>
> I'm not sure if this is helpful, but the waitid() system call
> (available since Linux 2.6.9) provides more precise control over which
> child state changes to wait for.
>
>  
>
> http://manpages.ubuntu.com/manpages/trusty/man2/wait.2.html
>
>  
>
this can happen because your python script (or the libs used there)
creates new processes and they terminate. Kamailio has a strict policy
on watching the children and terminating if one disappears.

I think we can relax that based on your suggestion. Can you make a pull
request on github.com/kamailio/kamailio with your proposed changes?

Ideally with a new parameter to control this behaviour, but don't worry
if it is not straightforward for you to look at flex/bison files, I will
do it on top of your patch.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - May 22-24 (USA) - www.asipto.com
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to