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

Continuation cancellation hangs #1195

Open
dhil opened this issue Jul 18, 2024 · 0 comments
Open

Continuation cancellation hangs #1195

dhil opened this issue Jul 18, 2024 · 0 comments
Labels

Comments

@dhil
Copy link
Member

dhil commented Jul 18, 2024

The cancellation mechanism of session exceptions causes the runtime/evaluator to hang indefinitely in some cases when the context to be cancelled closes over a captured continuation. The following example triggers this behaviour.

# options: `effect_handlers=true` and `session_exceptions=true`.
sig throw : () {Throw : forall a. () => a |e}~> a
fun throw() { do Throw }

sig example : () { Throw{_}, SessionFail{_} |e}~> ()
fun example() {
  handle({
    var c = fork(fun(c) {
      var (_, c) = receive(c);
      close(c)
    });
    throw();
    var c = send(42, c);
    close(c)
  }) {
    case <Throw => resume> : (forall a. () => a) ->
      try { raise; resume(unsafe_cast(())) }
      as () in { () }
      otherwise { () }
  }
}
@dhil dhil added the bug label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant