Skip to content

Commit 1004195

Browse files
committed
Prepare multiprocessing handling for Python 3.14
Python 3.14 changed multiprocessing method from 'fork' to 'forkserver' on Linux too: python/cpython#84559 This leads to issue similar to when Python 3.8 changed it on Mac OS: #57742 Change the condition to check for != 'fork' instead of == 'spawn'.
1 parent 3ce11a7 commit 1004195

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

changelog/68148.changed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
Update packaged python from 3.10 to 3.11
2+
Fix multiprocessing handling for python 3.14

salt/utils/platform.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,16 @@ def is_aarch64():
237237

238238
def spawning_platform():
239239
"""
240-
Returns True if multiprocessing.get_start_method(allow_none=False) returns "spawn"
240+
Returns True if multiprocessing.get_start_method(allow_none=False) != "fork"
241+
("spawn" or "forkserver")
241242
242243
This is the default for Windows Python >= 3.4 and macOS on Python >= 3.8.
243244
Salt, however, will force macOS to spawning by default on all python versions
245+
Starting with Python 3.14, Linux also defaults to not "fork", but it uses
246+
(new) "forkserver" instead of "spawn". Functionally, it's very similar as
247+
far as Salt is concerned (process state is not inherited).
244248
"""
245-
return multiprocessing.get_start_method(allow_none=False) == "spawn"
249+
return multiprocessing.get_start_method(allow_none=False) != "fork"
246250

247251

248252
def get_machine_identifier():

0 commit comments

Comments
 (0)