Skip to content

fix: add Drop to TaskManagerHandle to kill child processes on unexpec…#3

Merged
abdalla1912mohamed merged 1 commit intomainfrom
fix/task-manager-graceful-shutdown
Jan 29, 2026
Merged

fix: add Drop to TaskManagerHandle to kill child processes on unexpec…#3
abdalla1912mohamed merged 1 commit intomainfrom
fix/task-manager-graceful-shutdown

Conversation

@abdalla1912mohamed
Copy link

…ted exit

  • Add Drop impl for TaskManagerHandle that sends on the broadcast shutdown channel, triggering TaskManager::run() to call shutdown_all_tasks() which kills every process group
  • Fix TaskManager::run() to also call shutdown_all_tasks() when the mpsc channel closes (all handles dropped without explicit shutdown), preventing orphaned child processes
  • Extract duplicate process kill logic into terminate_process_group() helper used by both cancel_task and shutdown_all_tasks
  • Give TaskManagerHandle a clone of the broadcast shutdown_tx (previously #[allow(dead_code)] and unused on TaskManager)
  • Add tests: handle drop triggers shutdown, handle drop kills child processes

…ted exit

- Add Drop impl for TaskManagerHandle that sends on the broadcast
  shutdown channel, triggering TaskManager::run() to call
  shutdown_all_tasks() which kills every process group
- Fix TaskManager::run() to also call shutdown_all_tasks() when
  the mpsc channel closes (all handles dropped without explicit
  shutdown), preventing orphaned child processes
- Extract duplicate process kill logic into terminate_process_group()
  helper used by both cancel_task and shutdown_all_tasks
- Give TaskManagerHandle a clone of the broadcast shutdown_tx
  (previously #[allow(dead_code)] and unused on TaskManager)
- Add tests: handle drop triggers shutdown, handle drop kills
  child processes
@abdalla1912mohamed abdalla1912mohamed merged commit 613b107 into main Jan 29, 2026
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.

2 participants