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

Improve chained async exception/cancellation propagation #38904

Open
benaadams opened this issue Jul 8, 2020 · 3 comments
Open

Improve chained async exception/cancellation propagation #38904

benaadams opened this issue Jul 8, 2020 · 3 comments

Comments

@benaadams
Copy link
Member

Throwing and catching an exception isn't the cheapest of operations; which has been mentioned as a separate issue #12892 (comment)

However the way async propagates a thrown exception (or cancellation, which is via exceptions), is a chain of try/catch/throws; so the cost of an exception is multiplied by the number of awaits in the chain.

Could the propagation of exceptions in the common pattern of a chain of await -> await -> await be more efficient (avoiding the rethrow and catch step) to reduce this multiplication factor?

I'm mostly thinking for the simpler case where they flow directly(ish) into the next Task and then also fault or cancel that.

e.g. have the exception passed through the awaiter/asyncmethodbuilder mechanism and stamped with the next bit of stack rather than invoking the full exception handling machinery

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Jul 8, 2020
@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@mangod9 mangod9 removed the untriaged New issue has not been triaged by the area owner label Jul 29, 2020
@mangod9 mangod9 added this to the 6.0.0 milestone Jul 29, 2020
@janvorli janvorli modified the milestones: 6.0.0, 7.0.0 Jul 19, 2021
@timcassell
Copy link

timcassell commented Oct 19, 2021

Related: dotnet/csharplang#4565, and dotnet/roslyn#65863

@mangod9 mangod9 modified the milestones: 7.0.0, 8.0.0 Jul 19, 2022
@mangod9
Copy link
Member

mangod9 commented Jul 19, 2022

related to some experimentation for 8.

@mangod9 mangod9 modified the milestones: 8.0.0, Future Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants