You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Sebastien Binet (JIRA)" <ji...@apache.org> on 2019/04/09 10:06:00 UTC

[jira] [Assigned] (ARROW-5117) [Go] Panic when appending zero slices after initializing a builder

     [ https://issues.apache.org/jira/browse/ARROW-5117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebastien Binet reassigned ARROW-5117:
--------------------------------------

    Assignee: Sebastien Binet

> [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
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> {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
(v7.6.3#76005)