Skip to content

Commit c4c7930

Browse files
committed
Fix race condition in is_running when kill_whole_group is set
This fixes a bug introduced in ba7bb38 leading to `isotovideo can not be started` in openQA. We must not *only* check the process group because it might not have been created. (The `is_running` function might be called immediately after `start` when `setpgrp(0, 0)` hasn't been executed yet.) I tested this by putting `sleep 5` before `setpgrp(0, 0)`. Without this change openQA runs into `isotovideo can not be started` and with this change it works. I also tested whether cleanup of the whole process group still works. Related ticket: https://progress.opensuse.org/issues/170209
1 parent 0051f50 commit c4c7930

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/Mojo/IOLoop/ReadWriteProcess.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ sub is_running {
404404
my ($self) = shift;
405405
$self->session->consume_collected_info;
406406
return 0 unless my $pid = $self->process_id;
407-
kill(0, ($self->kill_whole_group ? -$pid : $pid));
407+
kill(0, ($self->kill_whole_group ? (-$pid, $pid) : ($pid)));
408408
}
409409

410410
sub write_pidfile {

0 commit comments

Comments
 (0)