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

QUIC: We should never catch an exception in event callbacks #55302

Closed
geoffkizer opened this issue Jul 7, 2021 · 3 comments · Fixed by #55442
Closed

QUIC: We should never catch an exception in event callbacks #55302

geoffkizer opened this issue Jul 7, 2021 · 3 comments · Fixed by #55442

Comments

@geoffkizer
Copy link
Contributor

Currently, we have a try/catch around all our msquic callbacks. If we catch an exception, we log it and return MsQuicStatusCodes.InternalError.

We should also assert here and fix any cases in which the assert fires. There should never be a valid reason for an exception to occur here, and if it does, it's quite likely that we are in a bad state.

@geoffkizer geoffkizer added this to the 6.0.0 milestone Jul 7, 2021
@ghost
Copy link

ghost commented Jul 7, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Currently, we have a try/catch around all our msquic callbacks. If we catch an exception, we log it and return MsQuicStatusCodes.InternalError.

We should also assert here and fix any cases in which the assert fires. There should never be a valid reason for an exception to occur here, and if it does, it's quite likely that we are in a bad state.

Author: geoffkizer
Assignees: -
Labels:

area-System.Net.Quic

Milestone: 6.0.0

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jul 7, 2021
@wfurt
Copy link
Member

wfurt commented Jul 8, 2021

One case I look at recently is for example certificate validation. That can also run user code. The current code makes validation errors hard to diagnose.
I was thinking about capturing the exception here and throwing on next API call like SslStream does

ThrowIfDisposedOrExceptional();

That would allow us to propagate errors to the user.

@geoffkizer
Copy link
Contributor Author

geoffkizer commented Jul 8, 2021

We shouldn't be running user code on the callback thread.

Edit to add: Though I'm not sure we have an alternative here; can you point me to where this happens?

@ManickaP ManickaP removed the untriaged New issue has not been triaged by the area owner label Jul 8, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jul 10, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jul 12, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants