Repository navigation
GH-54689: [Ruby] Keep TableBatchReader source table alive - #55245
Closed
mikamikasuki wants to merge 1 commit into
Closed
mikamikasuki wants to merge 1 commit into
mikamikasuki wants to merge 1 commit into
Conversation
|
|
Member
|
We don't need AI only contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
An exported TableBatchReader can outlive the temporary Ruby Table used to create it. The reader currently holds a reference to the Table, so importing the stream after Ruby garbage collection can segfault.
What changes are included in this PR?
Construct TableBatchReader with its shared_ptr
so it retains the source table for the reader’s lifetime.Are these changes tested?
Added a Ruby regression that exports a reader from a temporary table, runs GC, imports the stream, and reads all rows. The regression segfaults on current main and passes with this change. The full record-batch-reader test file passes (4 tests, 4 assertions). The Arrow C++ core, GLib bindings, and Ruby extension build succeeded.
Are there any user-facing changes?
This prevents a segmentation fault when an exported TableBatchReader is used after its source Ruby table wrapper is garbage-collected.
This PR contains a "Critical Fix". It prevents a crash when the source table is collected before the exported reader stream is used.
Was AI used for this PR?
OpenAI Codex assisted with root-cause analysis, implementation, and regression-test generation. The contributor reviewed the code and regression output.
PR code and description written by:
Reviewed before submission by:
Closes #54689