Changed the multiprocessing start method to 'spawn' because 'fork' (on *nix) seems to be unreliable with respect to queues. eric7

Wed, 21 Sep 2022 17:08:29 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 21 Sep 2022 17:08:29 +0200
branch
eric7
changeset 9348
f61d71d95cb1
parent 9344
52990830b13f
child 9349
df34d520c63b

Changed the multiprocessing start method to 'spawn' because 'fork' (on *nix) seems to be unreliable with respect to queues.

src/eric7/CodeFormatting/BlackFormattingDialog.py file | annotate | diff | comparison | revisions
src/eric7/Utilities/BackgroundClient.py file | annotate | diff | comparison | revisions
src/eric7/eric7.py file | annotate | diff | comparison | revisions
--- a/src/eric7/CodeFormatting/BlackFormattingDialog.py	Wed Sep 21 10:38:52 2022 +0200
+++ b/src/eric7/CodeFormatting/BlackFormattingDialog.py	Wed Sep 21 17:08:29 2022 +0200
@@ -345,15 +345,11 @@
             taskQueue.put("STOP")
 
         for worker in workers:
-            worker.join(2)  # 2 seconds timeout just in case
-            # TODO: monitor this change
-            if worker.exitcode is None:
-                worker.terminate()
+            worker.join()
             worker.close()
 
         taskQueue.close()
-        ##        doneQueue.close()
-        # TODO: monitor this change
+        doneQueue.close()
 
         self.__finish()
 
--- a/src/eric7/Utilities/BackgroundClient.py	Wed Sep 21 10:38:52 2022 +0200
+++ b/src/eric7/Utilities/BackgroundClient.py	Wed Sep 21 17:08:29 2022 +0200
@@ -9,14 +9,15 @@
 checkers and other python interpreter dependent functions.
 """
 
+import contextlib
 import io
 import json
+import multiprocessing
 import socket
 import struct
 import sys
 import time
 import traceback
-import contextlib
 from zlib import adler32
 
 
@@ -234,6 +235,8 @@
         )
         sys.exit(1)
 
+    multiprocessing.set_start_method("spawn")
+
     host, port, maxProcs, pyLibraryPath = sys.argv[1:]
 
     # insert pyLibraryPath into the search path because external stuff might
--- a/src/eric7/eric7.py	Wed Sep 21 10:38:52 2022 +0200
+++ b/src/eric7/eric7.py	Wed Sep 21 17:08:29 2022 +0200
@@ -14,6 +14,7 @@
 import contextlib
 import io
 import logging
+import multiprocessing
 import os
 import sys
 import traceback
@@ -238,6 +239,7 @@
     global app, args, mainWindow, splash, restartArgs, inMainLoop
 
     sys.excepthook = excepthook
+    multiprocessing.set_start_method("spawn")
 
     from PyQt6.QtGui import QGuiApplication
 

eric ide

mercurial