Skip to content

Commit

Permalink
Merge pull request #4 from dwave-examples/fix/dash-process-forking
Browse files Browse the repository at this point in the history
Use `spawn` instead of `fork` method for Dash callbacks
  • Loading branch information
randomir authored Jun 27, 2024
2 parents 771c9d8 + bd188e5 commit f2b5522
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@
cache = diskcache.Cache("./cache")
background_callback_manager = DiskcacheManager(cache)

# Fix Dash long callbacks crashing on macOS 10.13+ (also potentially not working
# on other POSIX systems), caused by https://bugs.python.org/issue33725
# (aka "beware of multithreaded process forking").
#
# Note: default start method has already been changed to "spawn" on darwin in
# the `multiprocessing` library, but its fork, `multiprocess` still hasn't caught up.
# (see docs: https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods)
import multiprocess
if multiprocess.get_start_method(allow_none=True) is None:
multiprocess.set_start_method('spawn')

from app_configs import (
APP_TITLE,
CLASSICAL_TAB_LABEL,
Expand Down

0 comments on commit f2b5522

Please sign in to comment.