Skip to content

Commit

Permalink
handler: Fix panic on GOARCH=386
Browse files Browse the repository at this point in the history
Fixes #1047
  • Loading branch information
Acconut committed Dec 14, 2023
1 parent f03aa9b commit 7f7d9b0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/handler/body_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@ import (
// the error but this can instead be done in the handler.
// In addition, the bodyReader keeps track of how many bytes were read.
type bodyReader struct {
// bytesCounter is the first field to ensure that its properly aligned,
// otherwise we run into alignment issues on some 32-bit builds.
// See https://github.com/tus/tusd/issues/1047
// See https://pkg.go.dev/sync/atomic#pkg-note-BUG
// TODO: In the future we should move all of these values to the safe
// atomic.Uint64 type, which takes care of alignment automatically.
bytesCounter int64
ctx *httpContext
reader io.ReadCloser
err error
bytesCounter int64
onReadDone func()
}

Expand Down

0 comments on commit 7f7d9b0

Please sign in to comment.