Skip to content

Should Await terminate eagerly when yielding in order? #438

Closed

Description

@atifaziz

When Await is required to yield results in order via AsOrdered, the task-based functions are still evaluated concurrently. If any one evaluation/task fails then Await will throw eagerly, possibly never yielding results that were successfully evaluated. Let's suppose that evaluations A, B and C are done asynchronously and concurrently but require results to be yielded in that same order. While A and B are in flight, C fails; Await will throw and attempt to abort the other two. This is a good thing because it means that there is no point in doing work if we know some future result will be an error. However, what if Await was combined with Take(2)? Such a computation would have terminated successfully! Bailing out eagerly seems to be the incorrect behaviour when results are requested in source-order.

It's interesting to note that PLINQ appears to abort eagerly as well when its AsOrdered is used. This observation is based on experimentation because the documentation doesn't call-out the behaviour explicitly.

I'm tagging this as a discussion before declaring it a bug.

Activity

  1. locked and limited conversation to collaborators on Nov 11, 2022
  2. converted this issue into a discussion #877 on Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions