4 ms·
As far as I understood, the module isn't launching threads at import time. On the contrary, the problem is that since pg is linked against macOS's Kerberos and
by dchest 9y ago
As far as I understood, the module isn't launching threads at import time. On the contrary, the problem is that since pg is linked against macOS's Kerberos and LDAP frameworks, as soon as the Objective-C runtime realizes that NSPlaceholderDictionary initialize method was called after fork(), it crashes:
One of the rules that Apple defined is that you may not call Foundation class initializers after forking.
- captainmuon 9y agoIn that case, the new behavior doesn't make sense. You could call `fork` as the very first thing in a program, and then do all the stuff in the subprocess, and I wouldn't expect it to make a big difference. Maybe there is an internal `mark_exec_as_called()` function that you could exploit, if you are forking without exec...
- eridius 9y agoWell, something must be spawning a thread first. From the Obj-C source¹, the comment on performForkChildInitialize() (the point where this crash happens) says > Exception: processes that are single-threaded when fork() is called have no restrictions on +initialize in the child. Examples: sshd and httpd. ¹ https://opensource.apple.com/source/objc4/objc4-723/runtime/objc-initialize.mm.auto.html https://opensource.apple.com/source/objc4/objc4-723/runtime/...