Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@xsedla1o
Copy link
Collaborator

Addresses issues with hanging threads that block the application shutdown.

Typically, when an unexpected error that we cannot recover from happens, we would like the app to shutdown and be completely restarted by the supervisor process. On rare occasions however, worker threads can get stuck and the app may hang indefinitely until killed by an administrator.

Now, when the graceful shutdown after failure does not complete within 60 seconds, TaskDistributor will force the entire process to quit using os._exit(), and stack traces will be printed for all threads to help diagnose problems post-mortem.

@xsedla1o xsedla1o requested review from Copilot and dbnk0 September 16, 2025 14:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses issues with hanging threads that prevent proper application shutdown by implementing a bounded graceful shutdown mechanism. When the TaskDistributor fails to shutdown within 60 seconds, it forces process termination and provides diagnostic information.

  • Adds timeout-bounded worker thread joining during shutdown
  • Implements forced process termination with os._exit() when graceful shutdown fails
  • Provides diagnostic thread stack dumps for post-mortem analysis

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@dbnk0
Copy link
Collaborator

dbnk0 commented Sep 17, 2025

Nice patch! Hopefully no more silent lockups of DP³.

@xsedla1o xsedla1o merged commit 8462863 into master Sep 18, 2025
4 checks passed
@xsedla1o xsedla1o deleted the ensure-shutdown branch September 18, 2025 10:11
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