-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
transport/http2_server : Move up streamID validation in operate headers #4873
Conversation
@easwars Could you please start the tests and review the PR? Thank you :D |
Moving to @dfawley for another look. The changes looked OK to me. But I couldn't find an existing test to which we could add a case for this change. |
Did you forget to push this commit? I still see the lock being used. |
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.
Actually there is another interaction here that we need to be careful about.
If an outgoing GOAWAY happens at the same time as we are processing an incoming header, we need to make sure that we are consistent: either we reject the stream and we make sure the GOAWAY stream ID includes it as unprocessed, or we process the stream and indicate that the GOAWAY did not omit it.
(I am pretty sure this will require a lock.)
@dfawley I actually did forget to push the atomic commits (Few tests were locally failing because of that commit so didn't push). For now, I have just put the unlock before the assignment of the buffer. |
I believe this still has the race, then. It was avoided before by checking the state of the transport after taking the lock and before deciding whether to allow the stream ID. Now the checks have been broken apart with an unlock between them. |
Right now, I am taking a lock, validating the stream ID, and unlocking. If stream ID is valid then we unlock and a new stream Object is created. If not, it returns the
Didn't understand this. The checks seem to be passing alright, is there something I am missing? |
EDIT: the "checks" I meant were "if conditions", not "our tests". Sorry for the confusion. Consider:
|
FWIW I believe the fix is as simple as including the transport state check along with the (now earlier) stream ID check, but I may be missing something else that makes that incorrect for another reason. |
@dfawley I was thinking on similar lines. Ultimately making that check to be - if t.state != reachable && !(t.state == draining && maxStreamID == streamID) {
t.mu.Unlock()
s.cancel()
return false
} This can keep the check right there if it's really important. |
That doesn't seem right. What would stop us from continually accepting new streams once we are in the draining state, since we update I just looked, and we can't simply move the state check. If we give up the lock and take it again later, we don't want to then later add the stream ID to What if we do the stream ID check above, like now, but make the assignment to |
Yes. You will need to make sure you always take |
@dfawley completed the changes as requested. |
@dfawley completed the changes as requested. |
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.
Thanks. I think this is almost done. It's too bad a decent test for this race would be ~impossible to write.
@dfawley thank you for your patient reviews, I have completed the changes as requested. |
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.
Thank you!
Let's wait until the branch cut for 1.42 before merging this PR, since the release is very soon and this is a semi-risky change without anyone specifically asking for it. |
@dfawley understandable, I wanted to know what's the general order in which issues/features are picked to be implemented? Is there a separate list altogether or they are all there in the issues section of Github? |
Everything on our radar is in the issues (or is a bigger project for the team). The "help wanted" label is the best place to look if you are looking for other things to contribute. Thanks! |
Fixes : #4779
Moved stream ID validation as mentioned in the issue and ensured illegal streamIDs are not used for new stream object creation.
RELEASE NOTES: