fix: harden prepared binary reset cleanup#23978
Merged
mergify[bot] merged 3 commits intomatrixorigin:mainfrom Mar 28, 2026
Merged
fix: harden prepared binary reset cleanup#23978mergify[bot] merged 3 commits intomatrixorigin:mainfrom
mergify[bot] merged 3 commits intomatrixorigin:mainfrom
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
LeftHandCold
approved these changes
Mar 28, 2026
Contributor
Merge Queue Status
This pull request spent 56 minutes 31 seconds in the queue, including 56 minutes 22 seconds running CI. Required conditions to merge
|
7 tasks
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.
What type of PR is this?
Which issue(s) this PR fixes:
issue #23977
What this PR does / why we need it:
This PR hardens prepared-statement binary protocol cleanup on
main.It fixes three closely related problems in the frontend prepare path:
PrepareStmt.Close()now keeps a valid process context for freeing binary parameter vectors after binary parsing.COM_STMT_RESET/reset preparenow clears accumulated binary prepared-statement state instead of acting like a no-op.COM_STMT_CLOSE,COM_STMT_RESET, and malformedCOM_STMT_EXECUTEerror paths now cleanly return and clean up instead of dereferencing nil state or leaving dirty binary state behind.Focused validation:
go test ./pkg/frontend -run 'Test_doResetClearsPreparedBinaryState|Test_ExecRequestPrepareCommandMissingStmt|Test_ExecRequestStmtExecuteErrorClearsPreparedBinaryState|TestPrepareStmtCloseAfterBinaryParamParsing|TestMysqlProtocolImpl_Close|Test_parseStmtSendLongData'