Skip to content

fix: avoid unaligned 64-bit atomic panic on 32-bit platforms#289

Merged
daveshanley merged 1 commit into
pb33f:mainfrom
siretart:reproduce-unaligned-atomic
Jun 24, 2026
Merged

fix: avoid unaligned 64-bit atomic panic on 32-bit platforms#289
daveshanley merged 1 commit into
pb33f:mainfrom
siretart:reproduce-unaligned-atomic

Conversation

@siretart

Copy link
Copy Markdown
Contributor

Reorder fields in regexCacheWatcher to place int64 counters before
the *sync.Map pointer. On 32-bit architectures (i386, armhf), pointers
are 4 bytes, causing the int64 fields to start at offset 4 -- which
is not 8-byte aligned. Go's sync/atomic.AddInt64 panics when the
target int64 is not 8-byte aligned on 32-bit platforms.

Found during Debian package build (golang-github-pb33f-libopenapi-validator)
on i386 and armhf.

Reorder fields in regexCacheWatcher to place int64 counters before
the *sync.Map pointer. On 32-bit architectures (i386, armhf), pointers
are 4 bytes, causing the int64 fields to start at offset 4 -- which
is not 8-byte aligned. Go's sync/atomic.AddInt64 panics when the
target int64 is not 8-byte aligned on 32-bit platforms.

Found during Debian package build (golang-github-pb33f-libopenapi-validator)
on i386 and armhf.
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.65%. Comparing base (bc5fd5a) to head (4f15cd5).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #289      +/-   ##
==========================================
- Coverage   98.08%   97.65%   -0.43%     
==========================================
  Files          64       65       +1     
  Lines        6987     7133     +146     
==========================================
+ Hits         6853     6966     +113     
- Misses        133      134       +1     
- Partials        1       33      +32     
Flag Coverage Δ
unittests 97.65% <ø> (-0.43%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@daveshanley daveshanley merged commit 17e8f98 into pb33f:main Jun 24, 2026
3 of 4 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.

2 participants