Skip to content

refactor: implement robust connection cleanup and fix task leakage#220

Open
rajanarahul93 wants to merge 1 commit into
dmnd-pool:masterfrom
rajanarahul93:fix/downstream-cleanup
Open

refactor: implement robust connection cleanup and fix task leakage#220
rajanarahul93 wants to merge 1 commit into
dmnd-pool:masterfrom
rajanarahul93:fix/downstream-cleanup

Conversation

@rajanarahul93
Copy link
Copy Markdown

@rajanarahul93 rajanarahul93 commented Apr 11, 2026

Summary

This PR resolves a resource leak where downstream background tasks were not correctly terminated upon connection loss. It ensures that if any task associated with a connection_id exits, a signal is sent to abort all other related tasks.

Key Changes

  • Task Cleanup: Added kill_signal triggers to the exit paths of the Notifier, Updater, Writer, and Share Monitor tasks.
  • Bug Fix: Changed return to break in receive_from_downstream.rs to prevent protocol errors from bypassing the cleanup logic.
  • Stability: Refactored safe_lock calls and Arc management to satisfy Rust's Send and move requirements without introducing redundant logic.

Verification

  • Automated Tests: cargo test passed (8 lib tests, 1 integration test).
  • Build: Successfully compiled with cargo build.
  • Manual: Verified binary integrity with dmnd-client --help.

fixes #19

@Fi3
Copy link
Copy Markdown
Contributor

Fi3 commented Apr 20, 2026

this need a test that reproduce the issue, it should fail before the patch and pass after.

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.

Kill notify task

2 participants