Hello,
Andre Hübner:
Hello,
for testing purposes i wrote a policy-service for postfix as a
shellscript.
My Script is working very well, iam happy with its functionality ;)
But unfortunately there is one problem when a lot of mails are incoming.
the
shellscript just does some grepping in small files etc. and is giving
back
a allowd result..
My Shellscript is spawned from master.cf like this:
policy-mycheck unix - n n - - spawn
user=nobody argv=nice -n 15 /usr/lib/postfix/mycheckscript.sh
When a lot of mails are incoming i got a high number of zombies. as a
consequence of this my system load gets really high.
Are there some general methods to avoid this?
Find out what is the parent process of the zombies. This parent
process is not cleaning up as it should.
Wietse
Unfortunately i cant bring it forward. i have no explanation for this.
Is it allowed to post some codelines? I will do it as short as possible,
showing just most significant lines.
I know, a bashscript as policy-service is not the best solution, but for my
purposes it should be enough.
May be the experts are seeing something and can tell a mistake i did.
This are my example scriptlines:
#!/bin/bash
while read line
do
# get some data from postfix input, just like this i do it for different
params like sasl_username, client_address, recipient (6 params att all)
sender_gefunden=`echo "$line" | tr -d '\n' | grep -i -v sasl_sender |
grep -i -c "sender="`
if [ 1 -eq $sender_gefunden ];then
sender_domain=`echo "$line" | tr -d '\n' | gawk -F '@' {'print $2'}`
sender_adresse=`echo "$line" | tr -d '\n' | gawk -F '=' {'print $2'}`
fi
#empty line, starting the interpretation
if [ -z "$line" ];then
# i do some tests if senderdomain is in content of a file and some
comparisons
senderdomain_is_localedomain=`cat /path/path/file | grep -i
"$sender_domain" | wc -l`
# after all i create one of 4 answers to postfix, which is sent bevor
done, but within the last if which checks that we are in last empty line of
postfix
postfixantwort="action=dunno\n\n"
printf $postfixantwort
#if i do an exit 0 here postfix writes in log "warning: premature
end-of-input on private/policy-sasl while reading input attribute name"
fi
done
# even if i jump out of the loop after getting and result and sending this
result as last line of my script there were zombies created :(
#end script
In processstatus this leads to al lot of zombieprocesses while runing
mycheckscript.sh
14953 nobody 20 0 0 0 0 Z 0 0.0 0:00.00
mycheckscript.sh <defunct>
14956 nobody 20 0 0 0 0 Z 0 0.0 0:00.00
mycheckscript.sh <defunct>
14957 nobody 20 0 0 0 0 Z 0 0.0 0:00.00
mycheckscript.sh <defunct>
14958 nobody 20 0 0 0 0 Z 0 0.0 0:00.00 tr <defunct>
14960 nobody 20 0 0 0 0 Z 0 0.0 0:00.00
mycheckscript.sh <defunct>
14961 nobody 20 0 0 0 0 Z 0 0.0 0:00.00 tr <defunct>
14966 nobody 20 0 0 0 0 Z 0 0.0 0:00.00 tr <defunct>
14969 nobody 20 0 0 0 0 Z 0 0.0 0:00.00 grep <defunct>
script functions are working, postfix is doing what my service answers.
confusing...
i have the suspicion that problem is related to the using of pipes (|) at
grep, tr, etc. and therefore subshells which could be the zombies, but in
mosz cases i cant avoid them...
I know, this is not a special postfix issue but it would be nice if someone
would have an idea of what is going wrong na dhelsp me out of my misery ;)
Thanks,
Andre