ashishnegi opened a new pull request, #366:
URL: https://github.com/apache/arrow-go/pull/366
### Rationale for this change
We saw crash with call stack:
```
error: runtime error: invalid memory address or nil pointer dereference
runtime.gopanic
runtime/panic.go:792
runtime.panicmem
runtime/panic.go:262
runtime.sigpanic
runtime/signal_unix.go:925
github.com/apache/arrow-go/v18/arrow/memory.(*Buffer).Bytes
github.com/apache/arrow-go/[email protected]/arrow/memory/buffer.go:106
github.com/apache/arrow-go/v18/parquet/file.(*page).Data
github.com/apache/arrow-go/[email protected]/parquet/file/page_reader.go:90
github.com/apache/arrow-go/v18/parquet/file.(*columnWriter).TotalBytesWritten
github.com/apache/arrow-go/[email protected]/parquet/file/column_writer.go:203
github.com/apache/arrow-go/v18/parquet/file.(*rowGroupWriter).Close
github.com/apache/arrow-go/[email protected]/parquet/file/row_group_writer.go:237
github.com/apache/arrow-go/v18/parquet/file.(*Writer).FlushWithFooter
github.com/apache/arrow-go/[email protected]/parquet/file/file_writer.go:229
github.com/apache/arrow-go/v18/parquet/file.(*Writer).Close
github.com/apache/arrow-go/[email protected]/parquet/file/file_writer.go:215
```
On code inspection, i see that if `WriteDataPage` fails, `w.pages` will
still be holding released `Buffer/Page`s.
On error handling, we close the parquet file, which tries to access
`w.pages` through `TotalBytesWritten()` - causing crash.
### What changes are included in this PR?
The PR includes a bug fix which removes the to-be released pages from
`w.pages`.
### Are these changes tested?
We verified the changes in our test. It now returns the error and does not
crash/panic.
Since this is a sad path handling, this should not impact happy code path.
### Are there any user-facing changes?
No
--
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]