]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Shm.pl
- kill fork if it has run for too long, and still exists!
[infobot.git] / src / Shm.pl
index 4d34170a391dd31bb35cef504990a7bb7e8b780e..6412e4db531d6eac36ea6e1a850eef058204958d 100644 (file)
@@ -96,8 +96,15 @@ sub addForked {
        next unless ($time > $forker_timeout);
 
        ### TODO: use &time2string()?
-       &WARN("Fork: looks like we lost '$_', executed $time ago.");
-       delete $forked{$_};
+       &WARN("Fork: looks like we lost '$_', executed $time ago");
+
+       if ( -d "/proc/$forked{$name}{PID}") {
+           my $pid = $forked{$name}{PID};
+           &status("Fork: killing $name ($pid)");
+           kill 9, $pid;
+       }
+
+       delete $forked{$name};
     }
 
     my $count = 0;