[ https://issues.apache.org/jira/browse/ARROW-5117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17662139#comment-17662139 ]
Rok Mihevc commented on ARROW-5117: ----------------------------------- This issue has been migrated to [issue #21603|https://github.com/apache/arrow/issues/21603] on GitHub. Please see the [migration documentation|https://github.com/apache/arrow/issues/14542] for further details. > [Go] Panic when appending zero slices after initializing a builder > ------------------------------------------------------------------ > > Key: ARROW-5117 > URL: https://issues.apache.org/jira/browse/ARROW-5117 > Project: Apache Arrow > Issue Type: Bug > Components: Go > Reporter: Alfonso Subiotto > Assignee: Sebastien Binet > Priority: Critical > Labels: easyfix, newbie, pull-request-available > Fix For: 0.14.0 > > Original Estimate: 1h > Time Spent: 2h 50m > Remaining Estimate: 0h > > {code:java} > array.NewInt8Builder(memory.DefaultAllocator).AppendValues([]int8{}, > []bool{}){code} > results in a panic > {code:java} > === RUN TestArrowPanic > --- FAIL: TestArrowPanic (0.00s) > panic: runtime error: invalid memory address or nil pointer dereference > [recovered] > panic: runtime error: invalid memory address or nil pointer dereference > [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 > pc=0x414f6fd]goroutine 5 [running]: > testing.tRunner.func1(0xc000492a00) > /usr/local/Cellar/go/1.11.5/libexec/src/testing/testing.go:792 +0x387 > panic(0x4cd1fe0, 0x5bb3fb0) > /usr/local/Cellar/go/1.11.5/libexec/src/runtime/panic.go:513 +0x1b9 > github.com/cockroachdb/cockroach/vendor/github.com/apache/arrow/go/arrow/memory.(*Buffer).Bytes(...) > > /Users/asubiotto/go/src/github.com/cockroachdb/cockroach/vendor/github.com/apache/arrow/go/arrow/memory/buffer.go:67 > github.com/cockroachdb/cockroach/vendor/github.com/apache/arrow/go/arrow/array.(*builder).unsafeSetValid(0xc000382a80, > 0x0) > > /Users/asubiotto/go/src/github.com/cockroachdb/cockroach/vendor/github.com/apache/arrow/go/arrow/array/builder.go:184 > +0x6d > github.com/cockroachdb/cockroach/vendor/github.com/apache/arrow/go/arrow/array.(*builder).unsafeAppendBoolsToBitmap(0xc000382a80, > 0xc00040df88, 0x0, 0x0, 0x0) > > /Users/asubiotto/go/src/github.com/cockroachdb/cockroach/vendor/github.com/apache/arrow/go/arrow/array/builder.go:146 > +0x17a > github.com/cockroachdb/cockroach/vendor/github.com/apache/arrow/go/arrow/array.(*Int8Builder).AppendValues(0xc000382a80, > 0xc00040df88, 0x0, 0x0, 0xc00040df88, 0x0, 0x0) > > /Users/asubiotto/go/src/github.com/cockroachdb/cockroach/vendor/github.com/apache/arrow/go/arrow/array/numericbuilder.gen.go:1168 > +0xcb > github.com/cockroachdb/cockroach/pkg/util/arrow_test.TestArrowPanic(0xc000492a00) > > /Users/asubiotto/go/src/github.com/cockroachdb/cockroach/pkg/util/arrow/record_batch_test.go:273 > +0x9a > testing.tRunner(0xc000492a00, 0x4ec5370) > /usr/local/Cellar/go/1.11.5/libexec/src/testing/testing.go:827 +0xbf > created by testing.(*T).Run > /usr/local/Cellar/go/1.11.5/libexec/src/testing/testing.go:878 +0x35cProcess > finished with exit code 1{code} > due to the underlying null bitmap never being initialized. I believe the > expectation is for `Resize` to initialize this bitmap. This never happens > because a length of 0 (elements in this block) fails this check: > {code:java} > func (b *builder) reserve(elements int, resize func(int)) { > if b.length+elements > b.capacity { > newCap := bitutil.NextPowerOf2(b.length + elements) > resize(newCap) > } > }{code} > As far as I can tell the arguments to AppendValues are valid. I'd be happy to > submit a patch but I can see several ways of fixing this so would prefer > someone familiar with the code to take a look and define expectations in this > case. -- This message was sent by Atlassian Jira (v8.20.10#820010)