News for hackers. Stuff that matters.
Re:Why Ruby App Servers Break on MacOS High Sierra by dchest on Thursday October 19, 2017 @07:12AM (#15506918)
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.

Re:Why Ruby App Servers Break on MacOS High Sierra by captainmuon on Thursday October 19, 2017 @09:22AM (#15507620)
In 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...

Re:Why Ruby App Servers Break on MacOS High Sierra by eridius on Thursday October 19, 2017 @02:57PM (#15510608)
Well, 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/...