-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[Go] parquet/pqarrow: panic: unaligned 64-bit atomic operation #43186
Description
Describe the bug, including details regarding any error messages, version, and platform.
On a 32-bit test, when calling a write buffered with the pqarrow's FileWriter I see a panic due to unaligned operation. I believe this is due to the various atomic.AddInt64 calls, in this case specifically this one, but this appears to be used by both pathBuilder and multipathLevelBuilder.
From the Go docs on this function:
AddInt64 atomically adds delta to *addr and returns the new value. Consider using the more ergonomic and less error-prone Int64.Add instead (particularly if you target 32-bit platforms; see the bugs section).
From the bugs section:
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.
Steps to reproduce
You can reproduce this by using GOARCH=386:
git clone git@github.com:powersj/telegraf -b feat/parquet-serializer
cd telegraf
GOARCH=386 go test -v ./plugins/outputs/parquet/...Trace
=== FAIL: plugins/outputs/parquet TestCases (0.00s)
panic: unaligned 64-bit atomic operation [recovered]
panic: unaligned 64-bit atomic operation
goroutine 7 [running]:
testing.tRunner.func1.2({0x902af40, 0x93eb378})
/usr/local/go/src/testing/testing.go:1631 +0x2a3
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1634 +0x434
panic({0x902af40, 0x93eb378})
/usr/local/go/src/runtime/panic.go:770 +0x103
runtime/internal/atomic.panicUnaligned()
/usr/local/go/src/runtime/internal/atomic/unaligned.go:8 +0x2d
runtime/internal/atomic.Xadd64(0xb43e9ac, 0xffffffffffffffff)
/usr/local/go/src/runtime/internal/atomic/atomic_386.s:125 +0x11
github.com/apache/arrow/go/v16/parquet/pqarrow.(*multipathLevelBuilder).Release(0xb43e960)
/go/pkg/mod/github.com/apache/arrow/go/v16@v16.1.0/parquet/pqarrow/path_builder.go:509 +0x3a
github.com/apache/arrow/go/v16/parquet/pqarrow.(*arrowColumnWriter).Write(0xb275c40, {0x93f7990, 0xb3c0d38})
/go/pkg/mod/github.com/apache/arrow/go/v16@v16.1.0/parquet/pqarrow/encode_arrow.go:198 +0x1b9
github.com/apache/arrow/go/v16/parquet/pqarrow.(*FileWriter).WriteColumnChunked(0xb3e3200, 0xb3b4f30, 0x0, 0x1)
/go/pkg/mod/github.com/apache/arrow/go/v16@v16.1.0/parquet/pqarrow/file_writer.go:330 +0xf7
github.com/apache/arrow/go/v16/parquet/pqarrow.(*FileWriter).WriteColumnData(0xb3e3200, {0x9401564, 0xb3b49f0})
/go/pkg/mod/github.com/apache/arrow/go/v16@v16.1.0/parquet/pqarrow/file_writer.go:339 +0x109
github.com/apache/arrow/go/v16/parquet/pqarrow.(*FileWriter).WriteBuffered(0xb3e3200, {0x9400770, 0xb3c7de0})
/go/pkg/mod/github.com/apache/arrow/go/v16@v16.1.0/parquet/pqarrow/file_writer.go:203 +0x413
github.com/influxdata/telegraf/plugins/outputs/parquet.(*Parquet).Write(0xb275f70, {0xb442520, 0x1, 0x1})
/go/src/github.com/influxdata/telegraf/plugins/outputs/parquet/parquet.go:119 +0x5d9
github.com/influxdata/telegraf/plugins/outputs/parquet.TestCases.func1(0xb362508)
/go/src/github.com/influxdata/telegraf/plugins/outputs/parquet/parquet_test.go:132 +0x118
testing.tRunner(0xb362508, 0xb3c7b00)
/usr/local/go/src/testing/testing.go:1689 +0x125
created by testing.(*T).Run in goroutine 6
/usr/local/go/src/testing/testing.go:1742 +0x3b9
DONE 7368 tests, 277 skipped, 2 failures in 133.817sComponent(s)
Go