Skip to content

[Ruby] Exported Arrow::TableBatchReader crashes after GC when its table is not referenced #54689

Open

Description

@himotoyoshi

Describe the bug, including details regarding any error messages, version, and platform.

A stream exported from an Arrow::TableBatchReader crashes when it is imported, if the table it was created from has been garbage collected.

require "arrow"

address = Arrow::TableBatchReader.new(Arrow::Table.new("a" => Arrow::Int32Array.new([1, 2, 3]))).export
GC.start
p Arrow::RecordBatchReader.import(address).read_all
# => [BUG] Segmentation fault at 0x0000000000000018

The crash is in arrow::ExportSchema, called from ExportStreamSchema:

libarrow.2500.1.0.dylib(_ZN5arrow12ExportSchemaERKNS_6SchemaEP11ArrowSchema+0x90)
libarrow.2500.1.0.dylib(_ZN5arrow12_GLOBAL__N_118ExportStreamSchemaERKNSt3__110shared_ptrINS_17RecordBatchReaderEEEP11ArrowSchema)

Environment: red-arrow 25.0.1, apache-arrow-glib 25.0.1 (Homebrew), Ruby 3.4.1, macOS 15.4.1 (arm64)

Possibly related to #54687

Component(s)

Ruby

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions