Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix parallel mode on macOS with python-3.8+ #88

Merged
merged 2 commits into from
Mar 16, 2025
Merged

Conversation

ploxiln
Copy link
Owner

@ploxiln ploxiln commented Mar 15, 2025

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 #74

fixes #27

@ploxiln ploxiln marked this pull request as draft March 15, 2025 16:32
The JobQueue originally supported both Thread and Process, even
though Fabric only used Process. This was mixed up a bit by
cdc597d / #74. For now, I think it's less invasive to fix,
than to rationalize by cleaning-out all non-Process support.
@ploxiln ploxiln marked this pull request as ready for review March 16, 2025 02:50
@ploxiln ploxiln merged commit 6bf4cc2 into master Mar 16, 2025
25 checks passed
@Stealthii
Copy link
Contributor

Appreciate the authored by tag! Thanks @rafecolton for re-raising this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@parallel doesn't work with Python 3.8
2 participants