We encountered an issue where our exported RecordBatchReaders were causing process aborts when a panic was thrown in the Rust code during iteration. It turned out this was happening only when converting the arro3 record batch readers into their pyarrow equivalents using RecordBatchReader.from_stream. When pyarrow uses the C stream capsule from pyo3-arrow, unwinding panics are not getting caught before crossing the FFI barrier, causing Python to crash.
We have a workaround, but I thought I would flag this issue, as it surprised me at first and might be worth documenting.
I wonder if it makes sense to upstream a catch_unwind either in this project or in FFI_ArrowArrayStream, but I don't feel fully aware of the caveats of doing so. I assume this issue affects the other FFI bindings as well.
We encountered an issue where our exported
RecordBatchReaders were causing process aborts when a panic was thrown in the Rust code during iteration. It turned out this was happening only when converting thearro3record batch readers into theirpyarrowequivalents usingRecordBatchReader.from_stream. When pyarrow uses the C stream capsule from pyo3-arrow, unwinding panics are not getting caught before crossing the FFI barrier, causing Python to crash.We have a workaround, but I thought I would flag this issue, as it surprised me at first and might be worth documenting.
I wonder if it makes sense to upstream a
catch_unwindeither in this project or in FFI_ArrowArrayStream, but I don't feel fully aware of the caveats of doing so. I assume this issue affects the other FFI bindings as well.