From 8d5be61fcb57f588908c7014de8fe31c4c5953cc Mon Sep 17 00:00:00 2001 From: Dusty Daemon Date: Wed, 23 Aug 2023 12:52:30 -0500 Subject: [PATCH] clnrest: Change process method to fork MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On mac the clnrest plugin hangs on log messages, causing it to never run. This guide suggests switching to fork’ing instead of spwan’ing https://superfastpython.com/multiprocessing-common-errors/#Error_2_print_Does_Not_Work_In_Child_Processes Switching to fork fixes the hang on Mac. Changelog-None --- plugins/clnrest/clnrest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/clnrest/clnrest.py b/plugins/clnrest/clnrest.py index de160e65e..763afeb32 100755 --- a/plugins/clnrest/clnrest.py +++ b/plugins/clnrest/clnrest.py @@ -4,6 +4,7 @@ try: import sys import os import time + import multiprocessing from gunicorn import glogging # noqa: F401 from gunicorn.workers import sync # noqa: F401 @@ -26,6 +27,7 @@ except ModuleNotFoundError as err: 'result': {'disable': str(err)}})) sys.exit(1) +multiprocessing.set_start_method('fork') jobs = {} app = Flask(__name__)