[SR-Users] SIGCHLD causes termination, but it appears that no child process has actually stopped.

Cody Herzog CHerzog at IntouchHealth.com
Thu Apr 27 04:18:14 CEST 2017


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

Thanks for any help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20170427/9391a578/attachment.html>


More information about the sr-users mailing list