Skip to content

Commit 3b15eae

Browse files
committed
Update multiprocessing start method for Linux
1 parent 713465d commit 3b15eae

File tree

3 files changed

+380
-347
lines changed

3 files changed

+380
-347
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ for future and past milestones.
3636
* Fixed test-related issues: some edge cases were hidden by the old test suite, and
3737
have been revealed by the transition to `pytest`. This has led to some bug fixes
3838
and improvements in the code.
39+
* On Linux, when running a computation on a signal or an image, and on rare occasions,
40+
the computation was stuck as if it was running indefinitely. Even though the graphical
41+
user interface was still responsive, the computation was not progressing and the user
42+
had to cancel the operation and restart it. This was due to the start method of the
43+
separate process used for the computation (default method was "fork" on Linux). This
44+
is now fixed by using the "spawn" method instead, which is the recommended method for
45+
latest versions of Python on Linux when multithreading is involved.
3946
* Fixed [Issue #60](https://github.com/DataLab-Platform/DataLab/issues/60) - `OSError: Invalid HDF5 file [...]` when trying to open an HDF5 file with an extension other than ".h5"
4047
* Deprecation issues:
4148
* Fixed `scipy.ndimage.filters` deprecation warning

cdl/core/gui/processor/base.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@
6363
# Enable multiprocessing support for Windows, with frozen executable (e.g. PyInstaller)
6464
multiprocessing.freeze_support()
6565

66+
# Set start method to 'spawn' for Linux (default is 'fork' which is not safe here
67+
# because of the use of Qt and multithreading) - for other OS, the default is
68+
# 'spawn' anyway
69+
try:
70+
multiprocessing.set_start_method("spawn")
71+
except RuntimeError:
72+
# This exception is raised if the method is already set (this may happen because
73+
# this module is imported more than once, e.g. when running tests)
74+
pass
75+
6676

6777
COMPUTATION_TIP = _(
6878
"DataLab relies on various libraries to perform the computation. During the "

0 commit comments

Comments
 (0)