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

Transport: AdaptiveRecvByteBufAllocator does not correctly calculate … #13882

Merged
merged 2 commits into from
Mar 2, 2024

Conversation

normanmaurer
Copy link
Member

…initial buffer capacity in some cases

Motivation:

We did not correctly calculate the initial index sometimes which could lead to the initial buffer capacity to exceed the configured maximum size.

Modifications:

  • Correctly calculate initialIndex
  • Add unit tests

Result:

Fixes #13722

…initial buffer capacity in some cases

Motivation:

We did not correctly calculate the initial index sometimes which could lead to the initial buffer capacity to exceed the configured maximum size.

Modifications:

- Correctly calculate initialIndex
- Add unit tests

Result:

Fixes #13722
Copy link
Contributor

@chrisvest chrisvest left a comment

Choose a reason for hiding this comment

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

The change itself looks good.
I noticed an issue in the existing logic constraining the indexes, that if you create a new AdaptiveRecvByteBufAllocator(81, 95, 95), for instance, the min index will be larger than the initial and max indexes, and it'll produce an initial allocation of size 80 even though the minimum size is 81.

@normanmaurer
Copy link
Member Author

@chrisvest got it…. let me fix this in a followup

@normanmaurer
Copy link
Member Author

@chrisvest fixed.... PTAL again

@normanmaurer normanmaurer added this to the 4.1.108.Final milestone Mar 1, 2024
@normanmaurer normanmaurer merged commit 85cee9d into 4.1 Mar 2, 2024
15 checks passed
@normanmaurer normanmaurer deleted the adaptive branch March 2, 2024 15:14
normanmaurer added a commit that referenced this pull request Mar 2, 2024
#13882)

…initial buffer capacity in some cases

Motivation:

We did not correctly calculate the initial index sometimes which could
lead to the initial buffer capacity to exceed the configured maximum
size.

Modifications:

- Correctly calculate initialIndex
- Add unit tests

Result:

Fixes #13722
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AdaptiveRecvByteBufAllocator has scenarios where it exceeds the specified maximum BUF capacity
2 participants