zeroshade commented on code in PR #1744:
URL: https://github.com/apache/iceberg-go/pull/1744#discussion_r3814480690
##########
table/inspect_files.go:
##########
@@ -106,12 +212,20 @@ func (i InspectTable) manifestEntryReader(
rows = 0
emitted = true
- return yield(batch, nil)
+ if yield(batch, nil) {
+ return true
+ }
+
+ batch.Release()
Review Comment:
Once `batch` has been passed to `yield`, ownership has transferred to
`ReaderFromIter`, even when `yield` eventually returns false because the reader
was released early. In that path the producer releases here, then
`iterReader.Release()` releases its `ir.cur` again. An assert-enabled build
panics with `too many releases`; normal builds underflow the reference count.
Please return the result of `yield` without releasing `batch`. The same issue
is present in `emitEmpty` below.
##########
table/inspect_files.go:
##########
@@ -164,7 +278,9 @@ func emptyInspectRecordBatch(alloc memory.Allocator, schema
*arrow.Schema) iter.
defer bldr.Release()
batch := bldr.NewRecordBatch()
- _ = yield(batch, nil)
+ if !yield(batch, nil) {
+ batch.Release()
Review Comment:
This empty-reader path has the same double-release. If a caller does
`Next()` and then `Release()`, `stop()` makes this `yield` return false, this
release runs, and `iterReader.Release()` releases the current batch a second
time. The producer should not release a record after yielding it; please
restore `_ = yield(batch, nil)` and add an early-release regression test for an
empty result.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]