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

Cap min and max ring size to 4K #5801

Merged
merged 2 commits into from Nov 18, 2022
Merged

Cap min and max ring size to 4K #5801

merged 2 commits into from Nov 18, 2022

Conversation

apolcyn
Copy link
Contributor

@apolcyn apolcyn commented Nov 18, 2022

This follows the settings described in grpc/proposal#338.

Note: a configuration option (preferable taking the form of a dial option, but possibly using a global) is left as a TODO.

Side note: this will mitigate internal issue b/255207468

cc @easwars

RELEASE NOTES:

  • ringhash: impose cap on max_ring_size to reduce possibility of OOMs

@dfawley dfawley added this to the 1.52 Release milestone Nov 18, 2022
@easwars easwars merged commit ff14680 into grpc:master Nov 18, 2022
1 check passed
jronak pushed a commit to jronak/grpc-go that referenced this pull request Nov 21, 2022
Comment on lines 60 to 62
if cfg.MinRingSize > cfg.MaxRingSize {
return nil, fmt.Errorf("min %v is greater than max %v", cfg.MinRingSize, cfg.MaxRingSize)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this check be done first? Otherwise it passes if Min > Max > MaxCap. Or is that okay?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because MaxCap is supposed to clamp min and max, I don't see a benefit of failing (beyond catching weird configuration). The client is still able to make use of such data sensibly, because of the clamp, so it seems overly fragile to fail.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants