Skip to content
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

compile a 32-bit LSB executable on arm and Execution error-> panic: unaligned 64-bit atomic operation #368

Open
912929782 opened this issue Jul 4, 2023 · 4 comments
Labels

Comments

@912929782
Copy link

912929782 commented Jul 4, 2023

What is the issue you are having?
panic: unaligned 64-bit atomic operation

goroutine 1 [running]:
runtime/internal/atomic.panicUnaligned()
        C:/GoSDK/src/runtime/internal/atomic/unaligned.go:8 +0x24
runtime/internal/atomic.Xadd64(0x13571684, 0x1)
        C:/GoSDK/src/runtime/internal/atomic/atomic_arm.s:258 +0x14
github.com/allegro/bigcache/v3.(*cacheShard).hit(0x13571600, 0x5819c5d75cbda787)
        C:/Users/Joker/go/pkg/mod/github.com/allegro/bigcache/v3@v3.1.0/shard.go:403 +0x34
github.com/allegro/bigcache/v3.(*cacheShard).get(0x13571600, {0x214747, 0x4}, 0x5819c5d75cbda787)
        C:/Users/Joker/go/pkg/mod/github.com/allegro/bigcache/v3@v3.1.0/shard.go:79 +0x3d0
github.com/allegro/bigcache/v3.(*BigCache).Get(0x2498980, {0x214747, 0x4})
        C:/Users/Joker/go/pkg/mod/github.com/allegro/bigcache/v3@v3.1.0/bigcache.go:136 +0x8c
@912929782 912929782 added the bug label Jul 4, 2023
@janisz
Copy link
Collaborator

janisz commented Jul 4, 2023

On ARM, 386, and 32-bit MIPS, it is the caller's responsibility to arrange for 64-bit alignment of 64-bit words accessed atomically via the primitive atomic functions (types Int64 and Uint64 are automatically aligned). The first word in an allocated struct, array, or slice; in a global variable; or in a local variable (because the subject of all atomic operations will escape to the heap) can be relied upon to be 64-bit aligned.

https://pkg.go.dev/sync/atomic#pkg-notes

So maybe we should switch to atomic.Int64 from int64

@janisz
Copy link
Collaborator

janisz commented Jul 4, 2023

I see 3 options:

@912929782 How to reproduce this issue? Does it happen with go test ./... we'll need to extend our CI with non x86 arch https://github.com/marketplace/actions/run-on-architecture

@912929782
Copy link
Author

I expect this problem to occur on x86 systems as well

@912929782
Copy link
Author

Forget to say, I am in the library: https://github.com/jpillora/overseer to use bigcache operation, result in this error. @janisz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants