Fix panic when WriteDataPage fails#366
Merged
zeroshade merged 2 commits intoapache:mainfrom May 2, 2025
Merged
Conversation
zeroshade
reviewed
May 1, 2025
Comment on lines
+425
to
433
| for i, p := range w.pages { | ||
| defer p.Release() | ||
| if err = w.WriteDataPage(p); err != nil { | ||
| // To keep pages in consistent state, | ||
| // remove the pages that will be released using above defer call. | ||
| w.pages = w.pages[i+1:] | ||
| return err | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Is there an easy way to add a test case for this?
Contributor
Author
There was a problem hiding this comment.
Added a unit test and updated PR description.
zeroshade
approved these changes
May 2, 2025
Member
zeroshade
left a comment
There was a problem hiding this comment.
Awesome, thanks! Will merge after CI finishes
Contributor
Author
|
@zeroshade Thanks for quick review! I am wondering if this can be back ported to latest stable release |
Member
|
I actually think it's about time for an 18.3.0 release :) so I'll start preparing that |
Contributor
Author
|
Hi @zeroshade |
Member
|
Hi! Sorry, I'll kick off the RC and the vote on the mailing list today. With luck I should be able to release v18.3.0 by Friday |
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
We saw crash with call stack:
On code inspection, i see that if
WriteDataPagefails,w.pageswill still be holding releasedBuffer/Pages.On error handling, we close the parquet file, which tries to access
w.pagesthroughTotalBytesWritten()- causing crash.What changes are included in this PR?
The PR includes a bug fix which removes the to-be released pages from
w.pages.Are these changes tested?
Added unit test.
Without the fix: test panics
With the fix:
Are there any user-facing changes?
No