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

Fix arm64 panic #130

Merged
merged 1 commit into from
Nov 8, 2024
Merged

Fix arm64 panic #130

merged 1 commit into from
Nov 8, 2024

Conversation

andig
Copy link
Contributor

@andig andig commented Nov 7, 2024

Users of evcc.io have just reported this panic on arm64:

panic: unaligned 64-bit atomic operation
goroutine 246 [running]:
internal/runtime/atomic.panicUnaligned()
        internal/runtime/atomic/unaligned.go:8 +0x24
internal/runtime/atomic.Load64(0x6521a1c)
        internal/runtime/atomic/atomic_arm.s:291 +0x14
github.com/go-telegram/bot.(*Bot).getUpdates(0x65219a8, {0x3373ff4, 0x5639a88}, 0x6c928c0)
        github.com/go-telegram/[email protected]/get_updates.go:52 +0x2c4

According to https://pkg.go.dev/sync/atomic#pkg-note-BUG:

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. The first word in a variable or in an allocated struct, array, or slice can be relied upon to be 64-bit aligned.

Rearranging the order of the structure fixes this.

@negasus negasus merged commit 78afaa2 into go-telegram:main Nov 8, 2024
1 check failed
@negasus
Copy link
Contributor

negasus commented Nov 8, 2024

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