Skip to content

fix: prevent double-close inflating zstd pool release counters#1

Merged
aron-muon merged 1 commit intomainfrom
aron/pool-closure-fix
Mar 12, 2026
Merged

fix: prevent double-close inflating zstd pool release counters#1
aron-muon merged 1 commit intomainfrom
aron/pool-closure-fix

Conversation

@aron-muon
Copy link
Owner

@aron-muon aron-muon commented Mar 12, 2026

Deploying from buildbarn#330

In writeZstd(), the zstdReader was closed twice: once by the buffer
(which takes ownership via NewCASBufferFromReader) and again by
defer zstdReader.Close(). Since metricsDecoder.Close() had no
double-close guard — unlike the underlying pooledDecoder — each
duplicate close incremented releases_total without a corresponding
acquisition, causing releases to permanently exceed acquisitions.

Remove the redundant defer and add double-close protection to both
metricsEncoder and metricsDecoder as a safety net.
@aron-muon aron-muon marked this pull request as ready for review March 12, 2026 11:59
@aron-muon aron-muon merged commit e6b8d0b into main Mar 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant