You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
38 lines
1.2 KiB
From 3b116169ec0f2213968780b6a2e3a85743a1a30f Mon Sep 17 00:00:00 2001
|
|
From: Miroslav Lisik <mlisik@redhat.com>
|
|
Date: Thu, 21 Mar 2024 13:32:10 +0100
|
|
Subject: [PATCH] Use 'forkserver' process creation method for multiprocessing
|
|
|
|
* 'fork' method could cause deadlock in multiprocessing.pool.Pool on
|
|
terminate (https://github.com/python/cpython/issues/73945)
|
|
* https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods
|
|
---
|
|
pcs/daemon/run.py | 7 +++++++
|
|
1 file changed, 7 insertions(+)
|
|
|
|
diff --git a/pcs/daemon/run.py b/pcs/daemon/run.py
|
|
index 5fa083fd..cecce750 100644
|
|
--- a/pcs/daemon/run.py
|
|
+++ b/pcs/daemon/run.py
|
|
@@ -1,3 +1,4 @@
|
|
+import multiprocessing as mp
|
|
import os
|
|
import signal
|
|
import socket
|
|
@@ -157,6 +158,12 @@ def _print_version(argv: StringCollection) -> None:
|
|
|
|
|
|
def main(argv=None) -> None:
|
|
+ # set the way how processes are started
|
|
+ # https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods
|
|
+ # avoid deadlock in multiprocessing.pool.Pool on terminate
|
|
+ # https://github.com/python/cpython/issues/73945
|
|
+ mp.set_start_method(method="forkserver")
|
|
+
|
|
argv = argv if argv is not None else sys.argv[1:]
|
|
if "--version" in argv:
|
|
_print_version(argv)
|
|
--
|
|
2.45.2
|
|
|