thanos
thanos copied to clipboard
Store: Fix panic too smaller buffer
- [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.
Could you sign this commit?
Could you sign this commit?
@saswatamcode signed, but the e2e test failed , i can't see error information
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.
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?
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.
I think a unit test is still good to have to catch such regression next time.
I think a unit test is still good to have to catch such regression next time.
I will get this merged to fix the bug. Thanks @dominicqi.