Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

returning inside whenever block causes MoarVM panic #6503

Open
p6rt opened this issue Sep 7, 2017 · 4 comments
Open

returning inside whenever block causes MoarVM panic #6503

p6rt opened this issue Sep 7, 2017 · 4 comments

Comments

@p6rt
Copy link

@p6rt p6rt commented Sep 7, 2017

Migrated from rt.perl.org#132044 (status was 'open')

Searchable as RT132044$

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 7, 2017

From @ugexe

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()
```

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 8, 2017

From @jnthn

On Thu, 07 Sep 2017 13​:33​:30 -0700, nlogan@​gmail.com wrote​:

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.

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 8, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 10, 2017

From @AlexDaniel

“almost always” indeed. It does work sometimes. Interesting.

On 2017-09-07 13​:33​:30, nlogan@​gmail.com wrote​:

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()
```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.