Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
4
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

posted at

updated at

Organization

macOS High Sierra で "__NSPlaceholderDictionary initialize" エラー

概要

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

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
4
Help us understand the problem. What are the problem?