Repository navigation
Conversation
somaz94
added a commit
to somaz94/somaz94
that referenced
this pull request
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On 386, arm and 32-bit mips the
statsfield ofcacheShardis not 8-byte aligned (it sits at offset 132 on 386), soatomic.AddInt64inhit()panics with "unaligned 64-bit atomic operation" on the firstGet.This moves the shard counters into a private struct of
atomic.Int64, which Go keeps 8-byte aligned, as suggested in #368. The publicStatstype keeps itsint64fields and JSON tags, so callers see no API change (#260 went to int32 instead).It also fixes a data race.
resetStatsreplaced the whole struct under the shard lock whilehit()adds outside it, so each counter is now reset withStore(0)and the lock is not needed there.TestCacheResetStatsWhileReadingfails under-raceon main and passes here.For the CI reproduction asked for in #368, there is a new
GOARCH=386 go teststep. The ubuntu runner executes 386 binaries natively, so qemu is not needed. On main this step fails with the same panic. It runs.and./queueonly, because the server tests useHardMaxCacheSize: 8192, and 8192 MiB in bytes wraps to 0 in a 32-bit int. That disables the cap, soTestInvalidPutWhenExceedShardCapgets 201 instead of 500. It looks like a separate bug, so I left it out.Validation: with Go 1.27.2 and 1.26.9,
go vet, golangci-lint v2.14.0 andgo test -race -count=1pass for all three packages, and the linux/386 test binaries for.and./queuepass in a 386 container.Fixes #368