pg.rb segmentation fault [Mojave upgrade]

2020-06-16 05:25发布

Segmentation fault in pg.rb:56

versions: rails: 5.2.0, ruby: 2.4.4, pg gem: 0.20.0

After upgrading to Mac OS mojave i have encountered problems with my local host server. The server itself, starts fine, however when trying to access it through a web browser, it crashes and I have the segmentation error shown above.

3条回答
成全新的幸福
2楼-- · 2020-06-16 06:07

As this issue is only occuring in the development environment, I made it conditional. This solution in puma.rb works for me until the bug gets fixed.

workers ENV.fetch("WEB_CONCURRENCY") { 2 } unless Rails.env.development?

查看更多
狗以群分
3楼-- · 2020-06-16 06:07

I had a similar issue, in which my test environment was often crashing in Ruby 2.6.3 with Segmnentation Fault lib/pg.rb line 56.

What worked for me was setting pumb.rb to have zero workers in the test environment:

# config/puma.rb
(ENV.fetch("RAILS_ENV") == 'test') ? (workers 0) : (workers ENV.fetch("WEB_CONCURRENCY") { 2 })
查看更多
家丑人穷心不美
4楼-- · 2020-06-16 06:23

in .env file set WEB_CONCURRENCY=0 and you do not need to add any logic in config/puma.rb

查看更多
登录 后发表回答