Skip to content

Conversation

@skladd
Copy link

@skladd skladd commented May 22, 2023

  • use pointers to allocated uin64 values instead field values
  • fixes "panic: unaligned 64-bit atomic operation" with Golang v1.20

…64bit alignment

fixes "panic: unaligned 64-bit atomic operation" with Golang v1.20
@skladd
Copy link
Author

skladd commented May 22, 2023

If compiling with go 1.20, influxd crashed after some time:

panic: unaligned 64-bit atomic operation

goroutine 23 [running]:
runtime/internal/atomic.panicUnaligned()
    /usr/lib/go-1.20/src/runtime/internal/atomic/unaligned.go:8 +0x24
runtime/internal/atomic.Xadd64(0x30bad54, 0x1)
    /usr/lib/go-1.20/src/runtime/internal/atomic/atomic_arm.s:258 +0x14
github.com/influxdata/influxdb/tsdb/engine/tsm1.(*accessor).incAccess(...)
    /go/github.com/simonvetter/influxdb/tsdb/engine/tsm1/reader.go:1497

This error didn't occur with golang 1.16.
Golang 1.19 brought own atomic.Uint64 types ensuring correct alignment, but this would break compiling using older go releases. Hence this fix via pointers.

Notes regarding alignment for atomic functions:
https://pkg.go.dev/sync/atomic#pkg-notes

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.

1 participant