I'm trying to run my integration tests as stated by the GCP guide to perform integration tests in cloud functions
However I find an error in macOS where I have to disable the "safe thread" option so that gunicorn can fork the current process
[2020-11-06 13:36:37 +0100] [6124] [INFO] Starting gunicorn 20.0.4
[2020-11-06 13:36:37 +0100] [6124] [INFO] Listening at: http://0.0.0.0:8080 (6124)
[2020-11-06 13:36:37 +0100] [6124] [INFO] Using worker: threads
[2020-11-06 13:36:37 +0100] [6127] [INFO] Booting worker with pid: 6127
objc[6127]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[6127]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
To enable it I had to set this flag (thanks to StackOverflow)
OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
I see that, when the functions-framework starts it says Using worker: threads. So can we use the "synchronous" gunicorn worker to avoid this? Or at least make it configurable as a click cli option?
Code I'm using
import signal
import subprocess
import sys
process = subprocess.Popen(
[
'functions-framework',
'--target', 'api',
'--port', '8080',
],
stdout=subprocess.PIPE,
)
def signal_handler(sig, frame):
process.kill()
process.wait()
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
signal.pause()
I'm trying to run my integration tests as stated by the GCP guide to perform integration tests in cloud functions
However I find an error in macOS where I have to disable the "safe thread" option so that gunicorn can fork the current process
To enable it I had to set this flag (thanks to StackOverflow)
I see that, when the functions-framework starts it says
Using worker: threads. So can we use the "synchronous" gunicorn worker to avoid this? Or at least make it configurable as aclickcli option?Code I'm using