Skip to content

fix: mem leak in write when I/O exception occurs#165

Merged
lszskye merged 1 commit into
alibaba:mainfrom
lxy-9602:fix-mem-leak-when-io-exception
Mar 4, 2026
Merged

fix: mem leak in write when I/O exception occurs#165
lszskye merged 1 commit into
alibaba:mainfrom
lxy-9602:fix-mem-leak-when-io-exception

Conversation

@lxy-9602
Copy link
Copy Markdown
Collaborator

@lxy-9602 lxy-9602 commented Mar 4, 2026

Purpose

This PR fixes a memory issue in MergeTreeWriter and MergeTreeCompactRewriter that occurs when an I/O exception happens during write or compaction.

Previously, upon I/O error, we called writer->Close() as part of cleanup. However, Close() may trigger a Flush() which attempts to write out buffered data. Due to shallow copies in the format layer (e.g., arrow array -> orc batch), some of this data may have already been released or invalidated by the time flush runs — leading to use-after-free.

@lszskye lszskye merged commit 9ed8cdd into alibaba:main Mar 4, 2026
8 checks passed
ChaomingZhangCN pushed a commit to ChaomingZhangCN/paimon-cpp that referenced this pull request Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants