fix parallel mode on macOS with python-3.8+ #88
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fab-classic's current implementation of parallel mode depends on multiprocessing using "fork" mode, not "spawn" mode (due to pickle-ability of some objects). Python-3.8 switched the default on macOS from "fork" to "spawn" because macOS system libraries often use threads which can cause instability if forked. In practice, fork usually works fine for fab-classic on macOS, and it's better than always failing or disabling parallel mode.
This situation may affect Linux too starting with Python-3.14 because "spawn" will be the default if there are any threads created, and paramiko uses threads. (In simple/regular cases it won't be a problem, because ssh connections will only be made by parallel sub-processes, but you can run multiple tasks where some do not allow parallel-mode ...)
Also fix-up support for Threads mode in
job_queue.py
, even though fab-classic doesn't use it, just to try to keep things working as close to original Fabric-1.x as possible, because I want to avoid re-designs in general, and keep this project on minimal-maintenance mode. This thread/process job_queue thing was a bit mixed-up by cdc597d in #74fixes #27