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

Store: Fix panic too smaller buffer #7658

Merged
merged 6 commits into from
Sep 4, 2024

Conversation

dominicqi
Copy link
Contributor

@dominicqi dominicqi commented Aug 22, 2024

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Related issue #6934
I think the problem could be: a buffer that was not obtained from the buffer pool should not be put back into it, as it will lead to buffers with incorrect sizes.

@saswatamcode
Copy link
Member

Could you sign this commit?

Signed-off-by: dominic.qi <dominic.qi@jaco.live>
@dominicqi
Copy link
Contributor Author

Could you sign this commit?

@saswatamcode signed, but the e2e test failed , i can't see error information

Copy link
Member

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

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

Could you add a unit test for this?

@dominicqi
Copy link
Contributor Author

Could you add a unit test for this?

Hi, @GiedriusS i haven't thought of what unit tests should be added yet. What do you think should be added? just moved the defer statement to the appropriate place.

@GiedriusS
Copy link
Member

Could you add a unit test for this?

Hi, @GiedriusS i haven't thought of what unit tests should be added yet. What do you think should be added? just moved the defer statement to the appropriate place.

I think a test should call that function twice and in the second call it should get a wrongly sized buffer with this bug, right?

Signed-off-by: qiyang <dominic.qiyang@gmail.com>
@dominicqi
Copy link
Contributor Author

Could you add a unit test for this?

Hi, @GiedriusS i haven't thought of what unit tests should be added yet. What do you think should be added? just moved the defer statement to the appropriate place.

I think a test should call that function twice and in the second call it should get a wrongly sized buffer with this bug, right?

I don't think so; the buffer pool returns a wrongly sized buffer because it has a smaller buffer. Just make sure only the obtained buffer can return to the pool.

@yeya24
Copy link
Contributor

yeya24 commented Sep 2, 2024

I think a unit test is still good to have to catch such regression next time.

@dominicqi
Copy link
Contributor Author

I think a unit test is still good to have to catch such regression next time.

@dominicqi dominicqi closed this Sep 3, 2024
@dominicqi dominicqi reopened this Sep 3, 2024
@yeya24
Copy link
Contributor

yeya24 commented Sep 4, 2024

I will get this merged to fix the bug. Thanks @dominicqi.

@yeya24 yeya24 merged commit 09db525 into thanos-io:main Sep 4, 2024
22 checks passed
jnyi pushed a commit to jnyi/thanos that referenced this pull request Oct 17, 2024
Co-authored-by: dominic.qi <dominic.qi@jaco.live>
Co-authored-by: Ben Ye <benye@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants