-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Exit properly and faster upon interruption
- Fix: Deadlock when multiprocessing is enabled and a direct `SIGINT` is recieved or an unhandled exception is raised, in the main process. When a `SIGINT` was recieved by the main process but not its children (unlike hitting `Ctrl-C` in the terminal) or an unhandled exception was raised, the main process blocked on trying to join its children which would still be running. Recieving subsequent `SIGINT`(s) terminated the main process but left the children running. - Add: `.logging_multi.multi_logger`. - Add: `.__main__.MAIN_THREAD. - Change: Replace `.cli.interrupted` with `.__main__.interrupted`. - Change: Make all subprocesses and threads (except `LoadingIndicator` and `MultiLogger`) daemon so they don't hinder the main process from exiting, and die when the main process exits. - Change: Subprocesses and non-main threads no longer check for main process interruption. - Change: All log records and notifications from subprocesses and non-main threads are no longer emitted after the main process is interrupted. - Change: No longer wait for `Opener`, `Getter-N` and `CheckManager` threads to exit normally upon main process interruption. - Change: Subprocesses are no longer joined when the main process is interrupted (by `SIGINT` or an exception). - Change: Join the `MultiLogger` thread instead of the log queue as items could now possibly be put into the queue after ending multi-process logging since the subprocesses are now daemon. - Change: `.logging_multi.loq_queue`: `multiprocessing.JoinableQueue` -> `multiprocessing.Queue` since the the queue is no longer joined. - Change: Update comments. Note: Sending `SIGINT` to the subprocesses would yield undesired results in the case of `Ctrl-C` being hit in the terminal as it'll result in subprocesses receiving double `SIGINT` and possibly an exception traceback being printed to STDERR by every subprocess.
- Loading branch information
1 parent
c3d972b
commit b90ceef
Showing
7 changed files
with
69 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.