thanos icon indicating copy to clipboard operation
thanos copied to clipboard

Store: Fix panic too smaller buffer

Open dominicqi opened this issue 1 year ago • 5 comments

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

Changes

Related issue https://github.com/thanos-io/thanos/issues/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.

dominicqi avatar Aug 22 '24 04:08 dominicqi

Could you sign this commit?

saswatamcode avatar Aug 22 '24 07:08 saswatamcode

Could you sign this commit?

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

dominicqi avatar Aug 22 '24 08:08 dominicqi

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.

dominicqi avatar Aug 23 '24 02:08 dominicqi

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?

GiedriusS avatar Aug 27 '24 06:08 GiedriusS

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.

dominicqi avatar Aug 28 '24 07:08 dominicqi

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

yeya24 avatar Sep 02 '24 16:09 yeya24

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

dominicqi avatar Sep 03 '24 09:09 dominicqi

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

yeya24 avatar Sep 04 '24 15:09 yeya24