Skip to content

Fix QueryServer _allChannels cleanup on channel close#17854

Merged
xiangfu0 merged 1 commit intoapache:masterfrom
suvodeep-pyne:spyne/query-server-allchannels-cleanup
Mar 11, 2026
Merged

Fix QueryServer _allChannels cleanup on channel close#17854
xiangfu0 merged 1 commit intoapache:masterfrom
suvodeep-pyne:spyne/query-server-allchannels-cleanup

Conversation

@suvodeep-pyne
Copy link
Contributor

@suvodeep-pyne suvodeep-pyne commented Mar 10, 2026

Summary

  • Adds a closeFuture listener in QueryServer.initChannel() to remove channels from _allChannels when they close, preventing indefinite accumulation of closed channel references (memory leak)
  • Adds @VisibleForTesting getConnectedChannelCount() getter for test access
  • Adds testAllChannelsCleanupOnClose test validating channels are cleaned up on close

Test plan

  • QueryServerTest#testAllChannelsCleanupOnClose — connects a socket, asserts channel registered, closes socket, asserts channel removed
  • Run full QueryServerTest: mvn -pl pinot-core test -Dtest=QueryServerTest -Drat.skip=true -Dcheckstyle.skip=true

_allChannels accumulates closed channel references indefinitely because
channels are added in initChannel() but never removed on close. Add a
closeFuture listener to remove the channel when it closes, preventing
the memory leak.
@xiangfu0 xiangfu0 merged commit 57d7e4b into apache:master Mar 11, 2026
15 of 16 checks passed
@codecov-commenter
Copy link

codecov-commenter commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.32%. Comparing base (58daa99) to head (9ec908d).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #17854      +/-   ##
============================================
+ Coverage     63.23%   63.32%   +0.08%     
  Complexity     1466     1466              
============================================
  Files          3190     3190              
  Lines        192009   192011       +2     
  Branches      29412    29412              
============================================
+ Hits         121424   121596     +172     
+ Misses        61063    60880     -183     
- Partials       9522     9535      +13     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-11 63.27% <100.00%> (+0.06%) ⬆️
java-21 63.23% <100.00%> (+0.02%) ⬆️
temurin 63.32% <100.00%> (+0.08%) ⬆️
unittests 63.32% <100.00%> (+0.08%) ⬆️
unittests1 55.58% <100.00%> (+0.01%) ⬆️
unittests2 34.32% <0.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants