-
Notifications
You must be signed in to change notification settings - Fork 4.5k
grpc: fix bug causing an extra Read if a compressed message is the same size as the limit #8178
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8178 +/- ##
==========================================
- Coverage 82.11% 82.04% -0.07%
==========================================
Files 410 410
Lines 40251 40251
==========================================
- Hits 33051 33023 -28
- Misses 5844 5862 +18
- Partials 1356 1366 +10
🚀 New features to boost your workflow:
|
Talked offline, it would be much simpler to restrict the max message size to |
Updated to use an io.LimitReader again. |
rpc_util_test.go
Outdated
case <-ctx.Done(): | ||
t.Fatalf("Timed out waiting for call to compressor") | ||
} | ||
ctx, cancel = context.WithTimeout(ctx, 10*time.Millisecond) |
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.
nit: Should we define a defaultTestShortTimeout
and use it here to avoid having tests using different wait durations later?
rpc_util_test.go
Outdated
return m, nil | ||
} | ||
|
||
func (m *mockCompressor) Read(p []byte) (int, error) { |
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.
nit: Vet is mentioning that the variable name can be dropped.
…me size as the limit (grpc#8178)
…me size as the limit (grpc#8178)
Fixes #8171
This is an alternate fix to the above issue as mentioned in #8172.
I'll add a test case that ensures Read is not called beyond io.EOF. But it looks like there might be some other problems with the tests in
rpc_util_test.go
, as several test cases are not setting the decompressor fielddc
, and I want to look at that more closely, too.cc @jhump
RELEASE NOTES: