Skip to content

Commit

Permalink
Fix occasional crashes associtated with timeouts
Browse files Browse the repository at this point in the history
Just sending a SIGHUP does not mean that we can close the channel, the
process is probably still alive and it will attempt to send stuff into
a closed channel.

This fixes #60. Previously this was the cause of MoarVM panics (until
it was fixed in Rakudo), but generally this is our fault.

However, there is still at least one bug in rakudo, which is why we
did not notice this problem right away. When the command prints a lot
of stuff into stdin, it will never time out. The whole thing is stuck
in a Proc::Async tap, without giving any chance for Promice.in(…) to
fire up.
  • Loading branch information
AlexDaniel committed Dec 3, 2016
1 parent 7cd3281 commit 3ac4ca3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Whateverable.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ method get-output(*@run-args, :$timeout = $!timeout, :$stdin) {
$proc.kill; # TODO sends HUP, but should kill the process tree instead
$out.send: «timed out after $timeout seconds, output»: ;
}
await $promise; # wait until it is actually stopped
$out.close;
return $out.list.join.chomp, $promise.result.exitcode, $promise.result.signal, $s-end - $s-start
}
Expand Down

0 comments on commit 3ac4ca3

Please sign in to comment.