Menu

#36 zombies and no cleanup on exit

open
None
5
2007-05-18
2007-05-18
cisxadmin
No

[17:01:32 root@mail init.d]# ps ax | grep perl
10178 ? S 0:00 /usr/bin/perl /usr/bin/swatch -c /var/log/mail/swatchrc -r 04:05 -t /var/log/maillog
10179 ? Z 0:00 [perl] <defunct>
24115 ? Z 0:00 [perl] <defunct>
31853 ? Z 0:00 [perl] <defunct>
27461 ? Z 0:00 [perl] <defunct>
23438 ? S 0:00 /usr/bin/perl /root/.swatch_script.10178
6010 ? Z 0:00 [perl] <defunct>
12954 ? Z 0:00 [perl] <defunct>
9320 ? Z 0:00 [perl] <defunct>
10425 ? Z 0:01 [perl] <defunct>
14944 ? Z 0:01 [perl] <defunct>
19891 ? Z 0:02 [perl] <defunct>
22484 ? Z 0:00 [perl] <defunct>
6694 ? S 0:00 /usr/bin/perl /root/.swatch_script.10178
23238 ? Z 0:02 [perl] <defunct>
23525 ? Z 0:02 [perl] <defunct>
26023 ? Z 0:02 [perl] <defunct>
31500 ? Z 0:02 [perl] <defunct>
31081 ? Z 0:00 [perl] <defunct>
7418 ? Z 0:00 [perl] <defunct>
14966 ? S 0:00 /usr/bin/perl /root/.swatch_script.10178
29010 ? Z 0:01 [perl] <defunct>
5649 ? Z 0:02 [perl] <defunct>
3249 ? Z 0:04 [perl] <defunct>
4011 ? Z 0:03 [perl] <defunct>
31728 ? Z 0:04 [perl] <defunct>
29825 ? Z 0:00 [perl] <defunct>
5277 ? S 0:00 /usr/bin/perl /root/.swatch_script.10178
19446 ? Z 0:04 [perl] <defunct>
19733 ? Z 0:06 [perl] <defunct>
23285 ? Z 0:04 [perl] <defunct>
7688 ? Z 0:05 [perl] <defunct>
11444 ? Z 0:05 [perl] <defunct>
22658 ? Z 0:00 [perl] <defunct>
31445 ? S 0:00 /usr/bin/perl /root/.swatch_script.10178
14491 ? Z 0:04 [perl] <defunct>
21037 ? Z 0:06 [perl] <defunct>
538 ? Z 0:06 [perl] <defunct>
22670 ? Z 0:07 [perl] <defunct>
13816 ? Z 0:07 [perl] <defunct>
926 ? Z 0:00 [perl] <defunct>
9916 ? S 0:00 /usr/bin/perl /root/.swatch_script.10178
25624 ? Z 0:08 [perl] <defunct>
19734 ? Z 0:07 [perl] <defunct>
6227 ? Z 0:06 [perl] <defunct>
22711 ? Z 0:07 [perl] <defunct>
3766 ? Z 0:07 [perl] <defunct>
17515 ? Z 0:00 [perl] <defunct>
28032 ? S 0:00 /usr/bin/perl /root/.swatch_script.10178
12171 ? Z 0:02 [perl] <defunct>
24029 ? Z 0:07 [perl] <defunct>
1786 ? Z 0:03 [perl] <defunct>
13809 ? Z 0:15 [perl] <defunct>
3997 ? Z 0:08 [perl] <defunct>
11757 ? Z 0:00 [perl] <defunct>
20720 ? S 0:00 /usr/bin/perl /root/.swatch_script.10178
3122 ? Z 0:11 [perl] <defunct>
27199 ? Z 0:09 [perl] <defunct>
3673 ? Z 0:09 [perl] <defunct>
16540 ? Z 0:10 [perl] <defunct>
17287 ? S 0:08 /usr/bin/perl /root/.swatch_script.10178
29353 pts/0 S+ 0:00 grep perl

swatch -c /var/log/mail/swatchrc -r 04:05 -t /var/log/maillog &

watchfor /timeout waiting for input|User unknown|collect/
exec echo -e "Subject:--- Sendmail Alert! ---\nFrom:log-swatch@mail.domain.com\nTo:root@domain.com<root@domain.com>\n""$_" | sendmail root@domain.com &

What is up with the zombies and the lack of clear up even after running "swatch -c /var/log/mail/swatchrc exit" ?

OS RH EL 4

Discussion

  • Todd Atkins

    Todd Atkins - 2007-05-18

    Logged In: YES
    user_id=595120
    Originator: NO

    What version are you running?

     
  • Todd Atkins

    Todd Atkins - 2007-05-18
    • assigned_to: nobody --> toddatkins
     
  • cisxadmin

    cisxadmin - 2007-05-21

    Logged In: YES
    user_id=1796476
    Originator: YES

    swatch-3.2.1

     
  • Mart Kolthof

    Mart Kolthof - 2008-01-19

    Logged In: YES
    user_id=1985823
    Originator: NO

    I had the same problems with Swatch 3.2.2 and was able to get rid of them by changing line 99 in Actions.pm from

    wait_pid(-1,WNOHANG);

    to

    wait_pid($exec_pid,0);

    This was proposed on http://www.perl.com/lpt/a/701 (Section Avoiding Zombie Processes). Mind you, I only tested in a Linux environment. Hope this helps.

     
  • John Horne

    John Horne - 2012-08-15

    Using swatch 3.2.3 with the 'exec' function I found by accident several zombie processes on several of our servers. Using the change below ('wait_pid($exec_pid,0);'), it now seems to be working fine for us. No zombies have appeared since restarting swatch.

    Any chance this, or similar fix, could be put into the main code?

    I see that 'swatch' itself sets $SIG{'CHLD'} to DEFAULT. Perhaps this should be changed to 'IGNORE', so that the zombie processes are collected?

     

Log in to post a comment.

MongoDB Logo MongoDB