-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
SocketAsyncContext.Unix: fix double processing of AsyncOperations #45683
Conversation
Tagging subscribers to this area: @dotnet/ncl Issue DetailsWhen a socket event occurs, the pending operations gets triggered The changes in #37974 When Process is called, the operation can complete, and the Fixes #45673 cc @geoffkizer @karelz @antonfirsov @stephentoub @dotnet/ncl
|
Thanks. We need to service for this as well, right? Seems like this could lead to really inconsistent and bad behaviors? |
Yes, I also think we need to service this. @geoffkizer I'm glad you noticed this. Figuring it out from a product bug report would have been a real challenge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
As a minimal fix this seems fine. That said, I don't think we need the |
When a socket event occurs, the pending operations gets triggered to continue their work by calling the Process method. The changes in dotnet#37974 cause Process to be called twice on the same AsyncOperation. When Process is called, the operation can complete, and the AsyncOperation instance may be reused for a different operation.
@geoffkizer can you please review the updated changes? |
@tmds To clarify the impact of this issue... I don't think an operation will ever be processed twice because of this issue, right? The logic in ProcessSyncEventOrGetAsyncEvent will return null if the op is processed, so the caller will not process it again. What will happen though is that the operation is always processed directly on the calling thread, as opposed to the logic in HandleEvents where we will dispatch one of the operations to the thread pool for processing if we have two operations to process. This seems like enough of a reason to backport it, as it could cause unexpected and mysterious delays in processing the second operation. But I don't think it's any worse than that, is it? |
@geoffkizer that's right, and it's a lot less worse than I thought. |
…tnet#45683) * SocketAsyncContext.Unix: fix double processing of AsyncOperations When a socket event occurs, the pending operations gets triggered to continue their work by calling the Process method. The changes in dotnet#37974 cause Process to be called twice on the same AsyncOperation. When Process is called, the operation can complete, and the AsyncOperation instance may be reused for a different operation. * Remove processAsyncEvents
When a socket event occurs, the pending operations gets triggered
to continue their work by calling the Process method.
The changes in #37974
cause Process to be called twice on the same AsyncOperation.
When Process is called, the operation can complete, and the
AsyncOperation instance may be reused for a different operation.
Fixes #45673
cc @geoffkizer @karelz @antonfirsov @stephentoub @dotnet/ncl