Bugfix/68573 multiprocessing wait importerror by harshang03 · Pull Request #68722 · saltstack/salt

What does this PR do?

Prevents Salt master/minion shutdown paths from crashing when multiprocessing.Process.join() triggers an ImportError due to partially-initialized stdlib modules (notably multiprocessing.connection.wait) during signal-handling / teardown re-entrancy. Adds a safer child-reaping path that falls back to non-blocking exitcode polling.

What issues does this PR fix or reference?

Fixes #68573

Previous Behavior

During shutdown (SIGTERM) on some systems, the master could log an unhandled exception like:
ImportError: cannot import name 'wait' from partially initialized module 'multiprocessing.connection'
originating from Process.join() while killing children.

New Behavior

Shutdown no longer fails due to this ImportError. Child cleanup is best-effort and robust: kill_children() tolerates join-time ImportErrors and reaps via exitcode polling instead.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

No