2017-10-05 91 views
4

我从Ruby 2.3.1升级到红宝石2.4.1并在这样做时独角兽似乎与新版本不兼容。我得到下面的错误。我正在使用Unicorn 5.1.0并尝试使用Unicorn 5.3.1无济于事。我是否需要使用其他库而不是XCode Tools进行编译?独角兽与红宝石2.4.1导致奇怪的崩溃

我立刻得到错误在与foreman start启动服务器和Procfile:

webpack: bin/webpack-dev-server 
gulp: gulp 
redis: ./scripts/start_redis_server.sh 
sidekiq: bundle exec sidekiq -C config/sidekiq.yml 
annotations_server: ./scripts/start_annotation_server.sh 
rails: bundle exec unicorn_rails -p 3000 -c config/unicorn.rb 

似乎启动和运行的罚款,如果我用一个简单bin/rails s我为什么我认为它是特定的独角兽。

objc[40847]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called. 
objc[40846]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called. 
objc[40846]: +[__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. 
objc[40847]: +[__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. 
E, [2017-10-05T12:12:01.618013 #40833] ERROR -- : reaped #<Process::Status: pid 40847 SIGABRT (signal 6)> worker=1 
E, [2017-10-05T12:12:01.618064 #40833] ERROR -- : reaped #<Process::Status: pid 40846 SIGABRT (signal 6)> worker=0 
I, [2017-10-05T12:12:01.619387 #40850] INFO -- : Refreshing Gem list 
I, [2017-10-05T12:12:01.620867 #40851] INFO -- : Refreshing Gem list 
+0

这确实不是很多的信息在这里。在什么情况下你会发生这种事故? – tadman

+0

刚启动本地开发服务器。我会用更多的细节更新这个问题。 – CWitty

回答

12

MacOS的高塞拉利昂changed the behaviour of the fork syscall,从而调用在派生进程的Objective-C API,作为错误处理。

在macOS High Sierra上使用Ruby时,这是Ruby所使用的。同样的问题也影响Puma和其他使用多进程模型的服务器,因此不是严格意义上的Unicorn(或Puma)问题,而是Ruby中的一个。

该问题在Unicorn mailing listPuma issue上进行了讨论。

作为一种变通方法,直到这个是固定的红宝石(或独角兽/彪马避开),你可以在启动Ruby进程之前添加以下环境变量:

OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES 
+0

我会稍后检查一下,并在验证后接受它,谢谢你的彻底回应。 – CWitty

+0

这样做,非常感谢。 – CWitty