[padb-devel] [padb] r197 committed - re-check that a given process exists when walking through /proc in a n...
codesite-noreply at google.com
codesite-noreply at google.com
Mon Sep 7 09:37:03 BST 2009
Revision: 197
Author: apittman
Date: Mon Sep 7 01:36:34 2009
Log: re-check that a given process exists when walking through /proc in a
number of places.
http://code.google.com/p/padb/source/detail?r=197
Modified:
/branches/cleanup/src/padb
=======================================
--- /branches/cleanup/src/padb Sun Sep 6 14:30:15 2009
+++ /branches/cleanup/src/padb Mon Sep 7 01:36:34 2009
@@ -656,6 +656,11 @@
foreach my $pid (@pids) {
next unless ( $pid =~ m{\A\d+\z}xms );
my ( undef, undef, undef, undef, $owner ) = stat("/proc/$pid");
+
+ # Check the stat worked, it's possible for processes to dissapear
+ # Take care to check for defined rather than true as root has a
+ # uid of zero.
+ next unless defined $owner;
next unless $owner == $uid;
push @userpids, $pid;
}
@@ -6570,7 +6575,7 @@
sub is_resmgr_process {
my $pid = shift;
my $name = find_from_status( $pid, 'Name' );
- my $mgrs = { 'rmsloader' => 1, 'slurmd' => 1, 'slurmstepd' => 1 };
+ my $mgrs = { rmsloader => 1, slurmd => 1, slurmstepd => 1 };
return 1 if ( defined $mgrs->{$name} );
return;
}
@@ -6891,11 +6896,16 @@
$newpid = $ppids[0];
}
- push @apids,
- {
- pid => $newpid,
- vp => $ip->{rank}
- };
+ # The process might have died and we simply didn't find anything,
+ # if this is the case then just skip it, the outer will notice
+ # the missing signon and report an approtiate error.
+ if ( defined $newpid ) {
+ push @apids,
+ {
+ pid => $newpid,
+ vp => $ip->{rank}
+ };
+ }
}
# Sort local pids by order of increasing rank.
More information about the padb-devel
mailing list