我正在从 Ruby 2.3.1 升级到 Ruby 2.4.1,这样做后 Unicorn 似乎与新版本不兼容。我收到以下错误。我正在使用 Unicorn 5.1.0 并尝试了 Unicorn 5.3.1 无济于事。我需要使用不同的库而不是 XCode Tools 进行编译吗?
我在启动服务器后立即收到错误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
MacOS 高山改变了的行为fork syscall http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html这样,分叉进程中对 Objective-C API 的调用就会被视为错误。
在 macOS High Sierra 上使用 Ruby 时,这就是 Ruby 使用的内容。同样的问题也影响 Puma 和其他使用多进程模型的服务器,因此严格来说不是 Unicorn(或 Puma)问题,而是 Ruby 问题之一。
该问题已在独角兽邮件列表 https://bogomips.org/unicorn-public/20170804191023.GA28511@dcvr/T/并在一个彪马号 https://github.com/puma/puma/issues/1421.
如果您出于任何原因需要坚持使用旧的 Ruby 版本,作为解决方法,您可以在启动 Ruby 进程之前添加以下环境变量:
OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
最好更新到 Ruby 2.4.4 或更高版本(包括 2.5 和 2.6)。这些版本包括the fix https://bugs.ruby-lang.org/issues/14009对于 Ruby 本身的这个问题,您不需要再设置环境变量。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)