#62 killall --older-than sometimes kills recently created processes

Next Release

I run an Apache/PHP server and sometimes a httpd process gets stuck due to external libraries. I use killall from psmisc-22.20 to kill them. I use the command line:

killall -v -q -uapache --older-than 2h httpd

It is set up in a cron job that runs every minute. It works fine most of the time, but sometimes it kills processes that had just been created. I know that because I also save the apache status page every minute.

I attached, as an example, three status pages from Apache around the time the newly created process was killed.

The first status page is from 8:18. Process 17958 wasn't created yet.

The second one is from 8:19. Process 17958 is there waiting for connections.

The third one is from 8:20. Process 17958 is gone.

Around that time, I got an email from Cron Daemon saying:

Killed httpd(17958) with signal 15

The process was obviously not over 2h old so killall shouldn't have killed it.

I think this happens when a process is just being created or just being terminated by Apache. killall fails to probe the right age if the process is being born or dying.

The Apache server is set up so that each process only serves one request. So processes are created and killed by Apache all the time.

I use CentOS 6.4 x64.

1 Attachments


  • Craig Small
    Craig Small

    This one is going to be tricky to catch. How often does it happen? I could send you a script that would:
    run killall with signal 0 (to capture the processes it might kill)
    cat those /proc/pid/status
    run killall with default signal

    The older than code is reasonably simple, I wonder if there is an overflow happening here?


  • Anonymous

    Post awaiting moderation.


Cancel   Add attachments