Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow for main thread having terminated pid, before ThreadPoolExecutor threads #54017
What does this PR do?
Checks if pid exists before using psutil to kill any children of the pid
What issues does this PR fix or reference?
Test would fail.
test should pass. The problem was that the ThreadExecutorPool executor.submit (4 of them) are handling the signal for the main thread too, which by the time they are called, is terminated. Fix is to check if the pid exists before having psutil attempt to use it and kill any existing children.
Yes, using existing tests, e.g. unit/transport/test_zeromq.py
Commits signed with GPG?
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.
@rares-pop @dwoz While just executing the try/except and catching the exception is still functional code, testing and skipping is faster code than having to handle an exception case, but this is a closing case, speed not really an issue. I shall adjust it so each child is tried rather than exiting after the first one, as for making it a utility and associated unit tests, I believe that is over-complicating code.