Public bug reported:
[Impact]
Package fails to build from source (FTBFS) on armhf architecture. The build
process panics during the test suite execution with an unaligned 64-bit atomic
operation.
[Build Log Snippet]
2026/09/24 09:22:33 http: panic serving 127.0.0.1:36862: unaligned 64-bit
atomic operation
goroutine 115 [running]:
net/http.(*conn).serve.func1()
/usr/lib/go-1.27/src/net/http/server.go:1939 +0xd8
panic({0x9c17d4, 0x5bf270})
/usr/lib/go-1.27/src/runtime/panic.go:859 +0xfc
internal/runtime/atomic.panicUnaligned()
/usr/lib/go-1.27/src/internal/runtime/atomic/unaligned.go:8 +0x24
internal/runtime/atomic.Xadd64(0x4ae3294, 0x1)
/usr/lib/go-1.27/src/internal/runtime/atomic/atomic_arm.s:319 +0x14
github.com/a-h/templ/cmd/templ/generatecmd/sse.(*Handler).ServeHTTP(0x4ae3290,
{0xa11c60, 0x4944f28}, 0x4944dc8)
[Root Cause]
This is a 32-bit memory alignment issue in Go. In
`cmd/templ/generatecmd/sse/server.go`, the `Handler` struct defines an `int64`
field (`counter`) immediately after a pointer field (`m *sync.Mutex`).
On 32-bit architectures, a pointer takes up exactly 4 bytes. This places
the 64-bit `counter` variable at a 4-byte memory offset. When
`sync/atomic` attempts to operate on this variable, the CPU panics
because 64-bit atomic instructions on 32-bit systems strictly require an
8-byte aligned memory address.
[Solution]
Moving the `counter int64` field to the very top of the `Handler` struct
ensures it sits at offset 0. This resolves the `sync/atomic` panic.
** Affects: golang-github-a-h-templ (Ubuntu)
Importance: Undecided
Assignee: Sumit Tiwari (sumit-tiwari)
Status: New
** Tags: stonking update-excuse
** Tags removed: update
** Tags added: update-excuse
** Changed in: golang-github-a-h-templ (Ubuntu)
Assignee: (unassigned) => Sumit Tiwari (sumit-tiwari)
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2169121
Title:
FTBFS on armhf due to unaligned 64-bit atomic operation
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/golang-github-a-h-templ/+bug/2169121/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs