-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: Panic on 32-bit platforms #43
Comments
Thank you for the issue and PR! I’ll take a look soon. I’ll be honest, I didn’t realize things like this weren’t handled automatically by Go. Really appreciate you bringing this to our attention. |
@JohnStarich no worries. I've got a PR in progress on my fork hairyhenderson#4 that I'll re-upstream once I get fully working. There's a bunch of other lint failures that'll need to be fixed separately though. I started on that a few days back in #42, but that was a sort of half-hearted effort 😉 |
@JohnStarich ok, I've got #44 up and ready to review - it fixes the bug 😁 |
Fixes #43 To solve this: - enabled the `fieldalignment` linter (which is a sub-linter of `govet`) - ran the `fieldalignment -fix` command to fix misaligned structs that were non-obvious - switch from using e.g. `int64` + `atomic.StoreInt64` to using `atomic.Int64` (etc) and because of this... - drop Go 1.18 support, and require Go 1.19+ (where the new atomic types were introduced) - added a new CI job to test in a 32-bit container (so far just Intel 386, which should catch the same bugs as arm32/etc) - added some new tests to cover `keyvalue/blob.Bytes`, which was what was giving me trouble initially --------- Signed-off-by: Dave Henderson <[email protected]>
Thanks again for your time and effort on this one! Your change has been released in |
Thanks for the quick review and release @JohnStarich! 🙇♂️ |
There are a number of field alignment issues in this package, which cause panics on 32-bit platforms. I built a quick Docker image to run the tests:
Dockerfile.test:
This particular failure is due to the
blob.Bytes
type, which is misaligned:If we run
fieldalignment
on this, we see (on 64-bit):And on 32-bit:
So it's not optimally-aligned, but that's not actually the root issue. The root issue is a known bug on 32-bit systems on many
atomic.*
functions, namely:Thankfully, fixing this automatically with
fieldalignment
works fine (it movesmu
to the beginning so we get a 32-byte or 16-byte offset beforelength
, thus aligninglength
on a 64-bit/8-byte boundary as it needs to be).I'm going to issue a PR that enables the
fieldalignment
linter (which is built into thegovet
linter in golangci-lint), and fixes the found problems.The text was updated successfully, but these errors were encountered: