pingcap / pingcap/ticdc

cdc may be stuck in logpuller PriorityQueue

Open
#4,636 0 comments 0 reactions 1 assignee View on GitHub

@wk989898 is already working on this.

Since Mar 30, 2026.

severity/minor type/bug
Dominant language
Go
Stars
56
Forks
63
Avg merge
2d 20h
Merged PRs (30d)
34

Description

PriorityQueue.Pop() will block and wait for pq.signal when called on an empty queue, but PriorityQueue.Close() only clears the heap and does not close or notify pq.signal. So if a goroutine is currently calling Pop() on an empty queue, it will not be awakened by Close(). Then this waiting party is not fake; it is a real consumer in the main chain: subscriptionClient.handleRegions() will loop and call s.regionTaskQueue.Pop(ctx). The ctx it passes in is the ctx derived from errgroup in Run(), not subscriptionClient's own s.ctx. So the key point is: although subscriptionClient.Close() will do s.cancel() and s.regionTaskQueue.Close(), if the outer Run()'s errgroup ctx hasn't been canceled yet, handleRegions() might continue to get stuck on Pop(ctx). The final manifestation is that shutdown doesn't complete cleanly, and Run() might hang.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.