fix(node_info): fix stale worker lock detection for zombie processes (#306)
Co-authored-by: Meliox <na>
This commit is contained in:
1 parent
e46734cd37
commit
f754331c3a
2 files changed
+17
-2
No files matched your search
@@ -91,7 +91,15 @@ sub read_sysfs {
|
||||
|
||||
sub is_process_alive {
|
||||
my ($pid) = @_;
|
||||
return -d "/proc/$pid";
|
||||
return 0 unless -d "/proc/$pid";
|
||||
# A zombie still has /proc/<pid> but is dead - otherwise a stale
|
||||
# worker lock is never cleaned up.
|
||||
if (open my $fh, '<', "/proc/$pid/stat") {
|
||||
my $line = <$fh>;
|
||||
close $fh;
|
||||
return 0 if defined $line && $line =~ /\)\s+Z\s/;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub read_lock_pid {
|
||||
|
||||
Reference in new issue
Block a user