On Thu, 01 Jun 2017 18:42:03 -0700, c...@zoffix.com wrote:
> This appears to hang more often than not, despite printing "Killing"
> messages.
> 
> perl6 -e 'await ^2 .map: {start { with Proc::Async.new: $*EXECUTABLE,
> "-e", "sleep" -> $p { Promise.in(2).then: {say "Killing"; $p.kill:
> SIGTERM}; await $p.start } }}'
> 
> However, if we reduce it to just 1 Proc, then it appears to work
> without issues, killing the spawned Proc every time:
> 
> perl6 -e 'await ^1 .map: {start { with Proc::Async.new: $*EXECUTABLE,
> "-e", "sleep" -> $p { Promise.in(2).then: {say "Killing"; $p.kill:
> SIGTERM}; await $p.start } }}'
> 
> 
> This looks to be the code handling the kill op, but I don't know if it
> looks wrong or not:
> 
> https://github.com/MoarVM/MoarVM/blob/dff6a4198f44d0b2793863cc56cc41679c36677f/src/io/procops.c#L1072-
> L1085
> 
> void MVM_proc_kill_async(MVMThreadContext *tc, MVMObject *handle_obj,
> MVMint64 signal) {
>     /* Ensure it's a handle for a process. */
>     if (REPR(handle_obj)->ID == MVM_REPR_ID_MVMOSHandle) {
>         MVMOSHandle *handle = (MVMOSHandle *)handle_obj;
>         if (handle->body.ops == &proc_op_table) {
>             /* It's fine; send the kill by cancelling the task. */
>             MVMIOAsyncProcessData *data = (MVMIOAsyncProcessData
> *)handle->body.data;
>             data->signal = signal;
>             MVM_io_eventloop_cancel_work(tc, data->async_task, NULL,
> NULL);
>             return;
>         }
>     }
>     MVM_exception_throw_adhoc(tc, "killprocasync requires a process
> handle");
> }


Thank you for the report. This is now fixed.

Fix:  https://github.com/rakudo/rakudo/commit/99421d4caa
Test: https://github.com/perl6/roast/commit/e484c9f27e

Reply via email to