Skip to content

Panics are not handled gracefully after conversion to C stream pycapsule #460

Description

@nvictus

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions