LoginSignup
9
4

More than 5 years have passed since last update.

macOS High Sierra で "__NSPlaceholderDictionary initialize" エラー

Last updated at Posted at 2018-01-09

概要

rugged という gem を使っていたところ、次のようなエラーに出くわしました。

objc[81924]: +[__NSPlaceholderDictionary 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.

原因は rugged ではなく、 macOS High Sierra での fork(2) システムコールにありました。

環境

  • Ruby 2.4.3
$ ruby -v
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin17]
  • macOS High Sierra 10.13.2
$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.13.2
BuildVersion:   17C205

ワークアラウンド

とりあえず、環境変数 OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES を指定すると、回避できました。

OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES bin/rails s

Ruby trunk にはパッチが取り込まれているようです。

Bug #14009: macOS High Sierra and “fork” compatibility - Ruby trunk - Ruby Issue Tracking System
https://bugs.ruby-lang.org/issues/14009

参考サイト

Why Ruby app servers break on macOS High Sierra and what can be done about it
https://blog.phusion.nl/2017/10/13/why-ruby-app-servers-break-on-macos-high-sierra-and-what-can-be-done-about-it/

macOS High Sierra で ruby-ldap を使った Rails アプリがコケるようになった(解決) - Qiita
https://qiita.com/bsdmad/items/6197583febb078869a49

MacOS High Sierra Apache, Case-insensitive FS causes fork() sanitizer crash. · Issue #1986 · phusion/passenger
https://github.com/phusion/passenger/issues/1986

Interoperability issues with dependencies using Objective-C in Cluster Mode on macOS 10.13 High Sierra · Issue #1421 · puma/puma
https://github.com/puma/puma/issues/1421

9
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
4