Skip Menu |
Report information
Id: 132044
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: nlogan [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



From: Nick Logan <nlogan [...] gmail.com>
Subject: returning inside whenever block causes MoarVM panic
Date: Thu, 7 Sep 2017 16:33:13 -0400
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 285b
The code below almost always results in "MoarVM panic: Internal error: Unwound entire stack and missed handler" ``` sub ran-ok() { react { my $proc = Proc::Async.new("echo", "1”); whenever $proc.start { return 1; } } } ran-ok() ```
Download (untitled) / with headers
text/plain 904b
On Thu, 07 Sep 2017 13:33:30 -0700, nlogan@gmail.com wrote: Show quoted text
> The code below almost always results in "MoarVM panic: Internal error: > Unwound entire stack and missed handler" > ``` > sub ran-ok() { > react { > my $proc = Proc::Async.new("echo", "1”); > whenever $proc.start { return 1; } > } > } > ran-ok() > ```
Odd. It should really be complaining about it being a return outside of the dynamic scope of the routine, since the whenever block will run on a different thread. I wonder if we can make this magically do what you wanted it to. I think maybe we can, but it's non-trivial since essentially we'd need to be having the return control exception caught, cause the react block to be torn down, and then re-throw it back on the thread that did the react. Also that would break the current "react is just like supply except it blocks" thing.
“almost always” indeed. It does work sometimes. Interesting.

On 2017-09-07 13:33:30, nlogan@gmail.com wrote:
Show quoted text
> The code below almost always results in "MoarVM panic: Internal error:
> Unwound entire stack and missed handler"
> ```
> sub ran-ok() {
> react {
> my $proc = Proc::Async.new("echo", "1”);
> whenever $proc.start { return 1; }
> }
> }
> ran-ok()
> ```




This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org