Skip to content

don't insert nil lazyReader to lazyReaders in case initalization fail…#8480

Merged
yeya24 merged 2 commits intothanos-io:mainfrom
erlan-z:bug-fix-for-block-lazyreader-nil-insertion
Jan 15, 2026
Merged

don't insert nil lazyReader to lazyReaders in case initalization fail…#8480
yeya24 merged 2 commits intothanos-io:mainfrom
erlan-z:bug-fix-for-block-lazyreader-nil-insertion

Conversation

@erlan-z
Copy link
Contributor

@erlan-z erlan-z commented Sep 9, 2025

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

Changes

This PR fixes a bug in ReaderPool.NewBinaryReader where a failed NewLazyBinaryReader could result in a nil entry being inserted into the lazyReaders map. When the idle reader closer later checked isIdleSince, it would panic on the nil object.
With this fix, a corrupt or incomplete block only causes queries against that block to fail, rather than taking down the entire store process.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xa0 pc=0x24feb92]

goroutine 196684 [running]:
../github.com/thanos-io/thanos/pkg/block/indexheader.(*LazyBinaryReader).isIdleSince(0x8080808080808080?, 0x0?)
 

Verification

Added TestReaderPool_NewBinaryReader_ErrDoesNotInsertNilReader to confirm that failed readers are not inserted and idle reader cleaner runs safely.

@erlan-z erlan-z force-pushed the bug-fix-for-block-lazyreader-nil-insertion branch from e71e1d8 to 5c2fb56 Compare September 9, 2025 00:54
…ed due to corrupt file or other errors

Signed-off-by: Erlan Zholdubai uulu <erlanz@amazon.com>
@erlan-z erlan-z force-pushed the bug-fix-for-block-lazyreader-nil-insertion branch from 5c2fb56 to 5dea5f4 Compare September 9, 2025 17:48
yeya24
yeya24 previously approved these changes Jan 15, 2026
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Thanks I think we just need to fix changelog. I think it makes sense to not cache it on error

@yeya24
Copy link
Contributor

yeya24 commented Jan 15, 2026

I fixed the merge conflict. Will merge on green

@yeya24 yeya24 merged commit 094aa1d into thanos-io:main Jan 15, 2026
41 checks passed
yuchen-db added a commit to databricks/thanos that referenced this pull request Jan 30, 2026
…ed due to corrupt file or other errors (thanos-io#8480)

Co-authored-by: Ben Ye <benye@amazon.com>
(cherry picked from commit 094aa1d)
coleenquadros pushed a commit to coleenquadros/thanos that referenced this pull request Mar 9, 2026
…ed due to corrupt file or other errors (thanos-io#8480)

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.

2 participants