Skip to content

Continuation cancellation hangs #1195

@dhil

Description

@dhil

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 { () }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions