Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
worker process: prevent worker from getting SIGKILL'd on KeyboardInte…
…rrupt While running script, sending <kbd>Ctrl</kbd> + <kbd>C</kbd> would also send SIGINT to the worker processes, but then [it would immediately follow up with a SIKILL][1] [after 0.25s][2]. This allowed very little time for workers to do cleanup, due to which, Python was raising `UserWarning` for leaked semaphores due to this: ```py .../lib/python3.12/site-packages/multiprocess/resource_tracker.py:257: UserWarning: resource_tracker: There appear to be 6 leaked semaphore objects to clean up at shutdown ``` Also see python/cpython#70130. This patch changes worker processes to be run using `subprocess.Popen` rather than `subprocess.run`, so that SIGKILL never gets sent. [1]: https://github.com/python/cpython/blob/3c770e3f0978d825c5ebea98fcd654660e7e135f/Lib/subprocess.py#L571-L573 [2]: https://github.com/python/cpython/blob/3c770e3f0978d825c5ebea98fcd654660e7e135f/Lib/subprocess.py#L891
- Loading branch information