Skip to content

Resource.eval extra cancellation point #4627

Description

@durban

As noticed during #4625, Resource.eval seems to have an extra cancellation point at the end. I think it shouldn't. Minimization:

    "Resource.eval" in real {
      val test = Resource
        .eval(IO.uncancelable(_ => IO.sleep(100.millis)))
        .timeout(10.millis)
        .use_
      test.as(ok)
    }

This fails with the 10.millis timeout. (Note: it passes with Resource.make.) Resource.eval is documented to "preserve interruptibility of fa". Which is very much uncancellable here. Yet, it is very much cancelled. (Or rather, it is cancelled right after the uncancelable ends, I think.) The crucial points in the code seem to be:

The obvious fix, i.e., F.uncancelable { poll => poll(fa).flatMap(a => ...) makes a lot of existing law tests fail, so more investigation is needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions