BUG: Zombies are back after signal was replaced by sigaction
As reported on the mailing list by Joe the on_xxxx commands can again cause Zombie processes.
The problem was not there in Motion 3.2.2_snap8 and was reintroduced in snap9.
There can be little doubt that it is the
ConvertSignalToSigaction patch that re-introduced the problem.
I need someone - maybe the original patch submitter - to re-visit this patch. Otherwise I see no other way out than going back to the original signal handling.
Test case
These are the details from Joes emails
Hi,
I just updated to 3.2.4snap4 today.
In my motion.conf i run a script:
on_picture_save /home/joe/motion_tuer/picSaved.sh %f
Motion runs the script and all of the script is done well.
But the script process remains as a zombie until motion is killed.
Can anyone confirm the problem ?
Joe
Hi,
picSaved.sh looks if the file is the 'lastsnap' and runs an other script in this case.
chkSabotage.sh uses the filesize of the jpeg to verify if there is something on the picture.
I have tried only with the log, but get the same problem.
With 3.2.2 i-ve got no such problem .
This is my motion.conf:
-------------
daemon on
#text_changes on
# quelle
input 0
videodevice /dev/video0
#einstellungen
threshold 2500
auto_brightness off
brightness 128
minimum_motion_frames 3
pre_capture 5
post_capture 5
lightswitch 80
low_cpu 3
framerate 3
text_double on
text_left %Y-%m-%d
text_right %T
# maskieren der bereiche die durch fremdpersonen genutzt werden
mask_file /home/joe/motion_tuer/tuer_maske.pgm
# schnappschuss zur sabotage prüfung
snapshot_interval 30
snapshot_filename lastsnap
#ausgabe
jpeg_filename M_%Y%m%d_%H%M%S-%q
quality 95
target_dir /home/joe/motion_tuer/tuer
#event
gap 60
on_event_end /home/joe/motion_tuer/eventEnd.sh
#bild gespeichert
on_picture_save /home/joe/motion_tuer/picSaved.sh %f
-------------
the picSaved.sh:
-------------
#!/bin/sh
if [ $# -lt 1 ]
then
exit 1
fi
if [ "$1" = "/home/joe/motion_tuer/tuer/lastsnap.jpg" ]
then
/home/joe/motion_tuer/chkSabotage.sh "$1"
fi
echo "picSaved ende" >> /home/joe/motion_tuer/tuer.log
exit 0
-------------
the chkSabotage.sh:
-------------
#!/bin/sh
baseDir="/home/joe/motion_tuer"
minFileSize=4000
sunrise=`sscalc -r -f %s` # in secunden seit 1970
sunset=`sscalc -s -f %s` # in secunden seit 1970
let sunsrise=sunrise+1800
let sunset=sunset-1800
jetzt=`date +%s`
echo "Pruefe auf Sabotage: $1 " >> /home/joe/motion_tuer/tuer.log
if [ $jetzt -gt $sunrise -a $jetzt -lt $sunset ]
then
# es sollte licht vorhanden sein
echo "Prüfe $1 auf Gültigkeit"
nice -n 19 convert "$1" -quality 70 "$baseDir/saboTest.jpg"
fileLaenge=`wc -c < "$baseDir/saboTest.jpg"`
rm -f "$baseDir/saboTest.jpg"
if [ $fileLaenge -lt $minFileSize ]
then
echo "---> Sabotageverdacht ! Size= $fileLaenge"
sabFileStr="$baseDir/sabotageverdacht/sab_`date +%Y%m%d-%H%M%S`"
cp $1 $sabFileStr
else
echo "---> File OK; Size= $fileLaenge"
fi
else
echo "$1 wird nicht geprüft. Es ist Nacht."
fi
echo "Pruefung fertig. " >> /home/joe/motion_tuer/tuer.log
exit 0
-------------
after a few minutes "ps -A" it looks like this:
3671 ? 00:00:00 motion
3672 ? 00:00:00 motion
3673 ? 00:00:08 motion
3674 ? 00:00:00 picSaved.sh <defunct>
3696 ? 00:00:00 picSaved.sh <defunct>
3701 ? 00:00:00 picSaved.sh <defunct>
3706 ? 00:00:00 picSaved.sh <defunct>
3711 ? 00:00:00 picSaved.sh <defunct>
3716 ? 00:00:00 picSaved.sh <defunct>
3721 ? 00:00:00 picSaved.sh <defunct>
... i got the problem with 'on_event_end' too.
goining back to 3.2.2. solves the problem.
3.2.4snap4 was compiled with ffmpeg 0.4.9(cvs) - 3.2.2 wasn't
I will try it tomorrow - i'm too sleepy now %-|
good night,
joe
Good morning,
i tried some different releases.
3.2.2snap8 was the last without the problem
since 3.2.2snap9 the problem occures.
Do i have to change my Scripts ?
Joe
OK. Then I know what the problem is.
It is this patch that changed the signal handling.
It seems this "improvement" does not really improve much. Maybe I should revert back to the old method.
Unless someone can improve the improvement.
Kenneth
Environment
Motion version: |
3.2.2_snap8 and on |
ffmpeg version: |
N/A |
Shared libraries: |
ffmpeg, mysql, postgresql |
Server OS: |
|
--
KennethLavrsen - 13 Nov 2005
Follow up
Fix record
Fixed in 3.2.2_snap5.
--
KennethLavrsen - 14 Nov 2005