Potential OOM in PopFrontDDL
Method of ddlPullerImpl
#11793
Labels
area/ticdc
Issues or PRs related to TiCDC.
impact/oom
severity/moderate
type/bug
The issue is confirmed as a bug.
What did you do?
Problem
In the
PopFrontDDL
method of theddlPullerImpl
struct, the operationh.pendingDDLJobs = h.pendingDDLJobs[1:]
is used to remove the first element from thependingDDLJobs
slice. However, this can lead to memory retention issues due to the behavior of Go slices:The problematic section of the code is as follows:
Proposed Solution
To resolve this issue, the reference to the removed element should be explicitly set to nil before updating the slice. This will break the reference to the element, allowing the garbage collector to reclaim the memory.
Updated code:
This issue is not a memory leak but a memory retention problem due to Go’s slice mechanics. The fix should improve the memory efficiency of the system.
What did you expect to see?
No memory retention problem.
What did you see instead?
Memory retention problem in
PopFrontDDL
method.Versions of the cluster
TiCDC version (execute
cdc version
):(paste TiCDC version here)
The text was updated successfully, but these errors were encountered: