Skip to content
This repository was archived by the owner on Jun 19, 2026. It is now read-only.

receive: Detach exemplar labels from pooled buffer#289

Merged
mkusumdb merged 1 commit into
db_mainfrom
kusum-madarasu_data/ad7
Feb 4, 2026
Merged

receive: Detach exemplar labels from pooled buffer#289
mkusumdb merged 1 commit into
db_mainfrom
kusum-madarasu_data/ad7

Conversation

@mkusumdb

@mkusumdb mkusumdb commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

Fixes a bug in #283 where exemplar labels were not detached from the pooled buffer, causing potential use-after-free issues when buffers are reused.

Exemplars also contain labels using zero-copy ZLabels that reference the underlying buffer. When the buffer is returned to the pool and reused:

  • Exemplar labels point to garbage data from the new request
  • Result: Data corruption, crashes, or incorrect exemplar data in TSDB

The fix ensures both timeseries labels AND exemplar labels are detached from the pooled buffer before async processing.

  - Exemplars contain labels that also use ZLabel (zero-copy)
  - Without this fix, exemplar labels would still reference the pooled buffer
  - When the buffer is returned to the pool and reused, the exemplar labels would point to garbage data
  - This would cause data corruption or crashes

  The fix ensures both timeseries labels AND exemplar labels are detached from the pooled buffer before async processing.
@mkusumdb mkusumdb requested a review from yuchen-db February 4, 2026 01:13
@mkusumdb mkusumdb merged commit c1359fe into db_main Feb 4, 2026
13 of 14 checks passed
@mkusumdb mkusumdb deleted the kusum-madarasu_data/ad7 branch February 4, 2026 01:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants