freeswitch
freeswitch copied to clipboard
bg_system leaves zombie processes
Describe the bug
Using bg_system by default uses fork() without waitpid, thus creating zombie processes
To Reproduce
fs_cli -x "bg_system echo hello"
ps -aux | grep freeswitch | grep 'Z'
I can't replicate this, please attach additional details, like OS, and such.
Debian buster I tested this on multiple machines

I can confirm this behaviour.
Debian GNU/Linux 11 (bullseye) Version 1.10.9-release+git~20230211T170413Z~e3d966f196~64bit
Problem can be solved by adding <param name="threaded-system-exec" value="true"/> to switch.conf.xml
CONFIRMED. I have an XML dialplan record that runs "bgsystem" (no underscore) to fork a simple shell script as a test before applying this to a production system that sends an e-mail via bgsystem. Currently it leaves a defunct process for each invocation, but after setting threaded-system-exec=true as indicated above it no longer leaves defunct processes. TNX!
<extension name="nofunct test">
<condition field="destination_number" expression="^9199$">
<action application="answer"/>
<action application="bgsystem" data="/usr/local/freeswitch/scripts/push.sh"/>
<action application="playback" data="tone_stream://L=3;%(100,100,1004)"/>
<action application="hangup"/>
</condition>
</extension>
push.sh
#!/bin/bash
echo "foodoo was here at `date` " >> /usr/local/freeswitch/scripts/outpush.txt