Skip to content

fix: [3.3.6] memory leak and use-after-free crash#35142

Merged
guanshengliang merged 2 commits into3.3.6from
fix/TD-6962275056-3.3.6
Apr 17, 2026
Merged

fix: [3.3.6] memory leak and use-after-free crash#35142
guanshengliang merged 2 commits into3.3.6from
fix/TD-6962275056-3.3.6

Conversation

@DuanKuanJun
Copy link
Copy Markdown
Contributor

Description

Issue(s)

  • Close/close/Fix/fix/Resolve/resolve: Issue Link

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

Copilot AI review requested due to automatic review settings April 15, 2026 02:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses memory-lifecycle issues (leaks / potential use-after-free) in client async DDL execution and executor sys-table scan flows, and tweaks CI upgrade compatibility download caching.

Changes:

  • Executor: free and clear pInfo->pRsp in sysTableScanFromMNode() to avoid stale pointers after freeing response buffers.
  • Client: free pQuery->pCmdMsg immediately after asyncSendMsgToServer() in asyncExecDdlQuery() to prevent orphaned allocations during shutdown/atexit teardown.
  • CI: lower cached “valid file” size threshold from 30M to 10M for upgrade compatibility artifact reuse.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
test/ci/run_upgrade_compat.sh Adjusts local cache validation threshold for downloaded “green versions”.
source/libs/executor/src/sysscanoperator.c Clears pInfo->pRsp when freeing response to avoid dangling pointers.
source/client/src/clientImpl.c Frees pQuery->pCmdMsg earlier in async DDL path to prevent leaks during teardown.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/ci/run_upgrade_compat.sh
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces memory management improvements by explicitly freeing pQuery->pCmdMsg in the client implementation and adopting taosMemoryFreeClear for response buffers in the system scan operator. It also reduces the cache validation size threshold in the CI upgrade script. Feedback indicates that the script's cache validation heuristic is fragile and recommends using a more robust method like checksums or manifest files to ensure environment consistency.

Comment thread test/ci/run_upgrade_compat.sh
@DuanKuanJun DuanKuanJun changed the title fix: memory leak and use-after-free crash fix: [3.3.6] memory leak and use-after-free crash Apr 15, 2026
@guanshengliang guanshengliang merged commit 622784b into 3.3.6 Apr 17, 2026
9 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants