-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Validate send quota again after acquiring writable channel #1367
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
Conversation
transport/http2_server.go
Outdated
func (t *http2Server) applySettings(ss []http2.Setting) { | ||
for _, s := range ss { | ||
if s.ID == http2.SettingInitialWindowSize { | ||
atomic.AddUint64(&t.outQuotaVersion, 1) |
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.
Will we apply settings more than once?
I'm thinking if we could use store
instead?
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.
Yes, InitialWindowSize settings frame can be sent multiple times during the life of a connection. In fact, that's why we're seeing this error. C decreases the IWS during it's bdp calculations causing the issue to occur.
// InitialWindowSize settings frame must have been received after we | ||
// acquired send quota but before we got the writable channel. | ||
// We must forsake this write. | ||
t.sendQuotaPool.add(ps) |
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.
Do we need to also return the stream quota?
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.
Yes, to keep things consistent. When the settings frame is received it adds to the current quota. Since we took something out of it earlier, we must add that back since we're not going to send anything.
2bdf68a
to
269d4a2
Compare
|
||
bdpEst *bdpEstimator | ||
bdpEst *bdpEstimator | ||
outQuotaVersion uint64 |
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.
Move version into quota.
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.
No, don't. There should only be one version per connection, not one per stream-quota.
Not sure, but this change appears to have broken compilation on ARM compilers. Running a simple binary in a raspberry pi results in this:
|
I'm not sure it's strictly 32 bit - I found that this: https://patch-diff.githubusercontent.com/raw/grpc/grpc-go/pull/1410.patch fixes the problem. The change you suggested above did not work. |
The change that you're pointing to only moves the field to the beginning of the struct. Am I reading it right? Why does it work? |
I do not pretend I understand why - it's something related to golang/go#599; I robbed the fix from fsouza/go-dockerclient@7a6bd15 |
The issue that you're pointing too is about making 64-bit variables work on 32-bit machines. In that case the second fix that I provided should work. |
Ah didn't see the second fix - that did the trick also. |
Cool, I've created a pull request to do just that. We'd rather use a 32-bit number than going the alignment route. |
Awesome thanks! |
Thanks for notifying. |
No description provided.