Skip to content

fix(query): stop flight exchange task after shutdown - #20229

Merged
zhang2014 merged 2 commits into
databendlabs:mainfrom
dqhl76:find-out-why-leak
Jul 31, 2026
Merged

fix(query): stop flight exchange task after shutdown#20229
zhang2014 merged 2 commits into
databendlabs:mainfrom
dqhl76:find-out-why-leak

Conversation

@dqhl76

@dqhl76 dqhl76 commented Jul 30, 2026

Copy link
Copy Markdown
Member

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

root cause: WatchNotify is sticky; calling notified() again would spin forever.

flowchart TD
    A["ExchangeSinkBuffer / PingPongExchange drop"] --> B["shutdown.notify_waiters()"]
    B --> C["PingPong task: finished = true"]
    C --> D["callback.has_pending()"]
    D --> E["recreate shutdown.notified()"]
    E --> F["sticky notification Ready immediately"]
    F --> C
Loading

fix: after finished signal, only drain the steam not wait notified future again.

close: #20228

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

AI assistance

  • AI usage: analyze the GDB/perf data, identify the root cause, implement the fix
  • Responsible human: @dqhl76
  • The responsible human has read every line of this diff and can explain each change

This change is Reviewable

@github-actions github-actions Bot added the pr-bugfix this PR patches a bug in codebase label Jul 30, 2026
@dqhl76
dqhl76 marked this pull request as ready for review July 30, 2026 03:46
@dqhl76
dqhl76 requested a review from zhang2014 July 30, 2026 05:44
@dqhl76

dqhl76 commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

The CI failure is unrelated to this PR. The same test case also fails on the main branch.

@zhang2014
zhang2014 merged commit b6a88c6 into databendlabs:main Jul 31, 2026
182 of 185 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix this PR patches a bug in codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: distributed queries leave detached Flight tasks consuming CPU after completion

2 participants