fork() semantics, using rq on macOS can lead to confusing crashes.
For instance, httpx uses internally
urllib.request.getproxies() from the standard library which makes the process crash with
objc: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. objc: +[__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. Moving job to FailedJobRegistry (work-horse terminated unexpectedly; waitpid returned 6)
The “solution” is running rq with the following environment variable set:
This is also the reason why
multiprocessing is not using
fork() by default on macOS since Python 3.8.
See also: How macOS Broke Python