Skip to content

GH-55628: [C++][Parquet] Stop finalizing column writers after failed writes - #55629

Open
fanruan-tuco wants to merge 1 commit into
apache:mainfrom
fanruan-tuco:GH-55628-parquet-failed-write-cleanup
Open

fanruan-tuco wants to merge 1 commit into
apache:mainfrom
fanruan-tuco:GH-55628-parquet-failed-write-cleanup

Conversation

@fanruan-tuco

@fanruan-tuco fanruan-tuco commented Nov 16, 2026 •

Copy link
Copy Markdown

A failed dictionary-encoded write (e.g. OOM while growing the dictionary hash table) can leave the encoder pointing at freed memory. The writer destructor still calls Close(), which writes the dictionary page and crashes with SIGSEGV instead of surfacing the error.

Fixes #55628.

Changes

  • Track a failed_ flag in ColumnWriterImpl, set around WriteBatch, WriteBatchSpaced, and WriteArrow for both exceptions and non-OK Status returns.
  • Close() and any further writes are rejected once a write has failed.

Tests

13 new regression cases inject OOM via ProxyMemoryPool, covering all three write entry points, explicit close vs. destruction, memory recovery, and non-OK Status returns. The column writer suite passes (316 tests).

Critical Fix: this fixes a crash (SIGSEGV) caused by use-after-free during writer destruction.

Was AI used for this PR?

  • PR code and description written by: AI
  • Reviewed before submission by: Human

🤖 Generated with Claude Code

…ailed writes

Co-Authored-By: Claude Code <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Thanks for opening a pull request!

This pull request has been automatically converted to a draft because its title doesn't match Arrow's required format.

If this is not a minor PR, could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

After updating the title, you can mark the pull request as ready for review.

See also:

@github-actions
github-actions Bot marked this pull request as draft November 16, 2026 08:50
@fanruan-tuco fanruan-tuco changed the title [C++][Parquet] Stop finalizing column writers after failed writes GH-55628: [C++][Parquet] Stop finalizing column writers after failed writes Nov 16, 2026
@fanruan-tuco
fanruan-tuco marked this pull request as ready for review November 16, 2026 08:55
@fanruan-tuco

Copy link
Copy Markdown
Author

@pitrou @HuaHuaY @wgtmac mind taking a look?

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #55628 has been automatically assigned in GitHub to PR creator.

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #55628 has no components, please add labels for components.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C++][Parquet] Writer cleanup can crash after dictionary hash table resize fails with OOM

1 participant