Skip to content

fix: clear prepared binary param state#23984

Merged
mergify[bot] merged 3 commits intomatrixorigin:mainfrom
XuPeng-SH:fix-prepare-param-growth
Mar 28, 2026
Merged

fix: clear prepared binary param state#23984
mergify[bot] merged 3 commits intomatrixorigin:mainfrom
XuPeng-SH:fix-prepare-param-growth

Conversation

@XuPeng-SH
Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #23983

What this PR does / why we need it:

This PR reclaims prepared-statement binary parameter state after COM_STMT_EXECUTE and on malformed execute cleanup.

It fixes two closely related problems on main:

  1. repeated binary executes with varlen parameters reused the same params vector and kept appending to its area, growing session memory until statement close;
  2. malformed COM_STMT_EXECUTE packets could leave a partially populated params vector attached to the prepared statement because the parse-error path dropped the statement pointer before cleanup.

Focused validation:

  • go test ./pkg/frontend -run 'TestPrepareStmtClearBinaryParamStateReleasesParamArea|Test_ExecRequestStmtExecuteErrorClearsPreparedParamState'
  • go test ./pkg/frontend -run 'TestPrepareStmtClearBinaryParamStateReleasesParamArea|Test_ExecRequestStmtExecuteErrorClearsPreparedParamState|Test_parseStmtSendLongData'

@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Mar 27, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Mar 27, 2026
@XuPeng-SH XuPeng-SH requested a review from LeftHandCold March 27, 2026 23:59
@mergify mergify Bot added the queued label Mar 28, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 28, 2026

Merge Queue Status

  • Entered queue2026-03-28 00:12 UTC · Rule: main
  • 🚫 Left the queue2026-03-28 01:08 UTC · at 9be5b0ed01410f10b33f30972bde98b6ea1f24f7

This pull request spent 55 minutes 49 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

merge conflict between base and head

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

@mergify mergify Bot added dequeued and removed queued labels Mar 28, 2026
XuPeng-SH and others added 2 commits March 28, 2026 11:43
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Align Test_ExecRequestStmtExecuteErrorClearsPreparedBinaryState with the current fix behavior: malformed COM_STMT_EXECUTE cleanup frees the params vector and clears the pointer, so the test must assert nil instead of dereferencing the released vector.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 28, 2026

Merge Queue Status

  • Entered queue2026-03-28 04:40 UTC · Rule: main
  • Checks passed · in-place
  • Merged2026-03-28 06:30 UTC · at 1e39ab148e28be812085c18070fb27fc68027efe

This pull request spent 1 hour 50 minutes 16 seconds in the queue, including 55 minutes 57 seconds running CI.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • branch-protection-review-decision = APPROVED [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-neutral = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Ubuntu/x86
    • check-neutral = Matrixone CI / SCA Test on Ubuntu/x86
    • check-skipped = Matrixone CI / SCA Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-neutral = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-skipped = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage

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

Labels

kind/bug Something isn't working size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants