在Heroku,Cedar,与Unicorn:获取ActiveRecord :: StatementInvalid:PGError:SSL SYSCALL错误:检测到EOF

时间:2022-10-18 20:38:05

Heroku support says this has to do with their version of libssl on shared databases, but we've encountered it on a project that's on a dedicated database, too.

Heroku支持称这与他们在共享数据库上的libssl版本有关,但我们也在一个专用数据库上的项目中遇到过它。

Basically this error happens every so often (closer to just after a deploy) on every project we've moved to the new Cedar stack with Unicorn configured to 3 workers:

基本上这个错误经常发生(接近部署之后)我们已经转移到新的Cedar堆栈,而Unicorn配置为3个工作人员:

Error Message:

错误信息:

ActiveRecord::StatementInvalid: PGError: SSL SYSCALL error: EOF detected : SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.at

Where:
some_controller#index
[PROJECT_ROOT]/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.11/lib/active_record/connection_adapters/postgresql_adapter.rb, line 505

No answers from heroku yet besides maybe wait who knows how long for us to upgrade our shared database servers* and I haven't found anything on google.

没有heroku的答案,但也许等待谁知道我们升级我们的共享数据库服务器*多久,我没有在谷歌上找到任何东西。

They also suggested it has to do with unicorn's workers overlapping and that we should switch to Thin but the performance gain is well worth the occasional error(I think!). I'm hoping there's a way to configure Unicorn to prevent the overlap.

他们还建议它与独角兽的工人重叠有关,我们应该切换到Thin,但性能提升非常值得偶尔出错(我想!)。我希望有一种方法可以配置Unicorn以防止重叠。

Has anyone encountered this, and if so, what have you done to resolve it? Thanks!

有没有人遇到过这个,如果有的话,你做了什么来解决它?谢谢!

*not their actual words, just how I felt after their response.

*不是他们的实际用语,而是他们回答后的感受。

1 个解决方案

#1


24  

Heroku support suggested that I add this to my Unicorn config:

Heroku支持建议我将它添加到我的Unicorn配置中:

Append to your config/unicorn.rb:

附加到config / unicorn.rb:

after_fork do |server, worker|
  if defined?(ActiveRecord::Base)
    ActiveRecord::Base.establish_connection 
  end
end

I added it and we haven't seen a single PGError: SSL SYSCALL error all day.

我添加了它,我们没有看到一个PGError:SSL SYSCALL错误整天。

#1


24  

Heroku support suggested that I add this to my Unicorn config:

Heroku支持建议我将它添加到我的Unicorn配置中:

Append to your config/unicorn.rb:

附加到config / unicorn.rb:

after_fork do |server, worker|
  if defined?(ActiveRecord::Base)
    ActiveRecord::Base.establish_connection 
  end
end

I added it and we haven't seen a single PGError: SSL SYSCALL error all day.

我添加了它,我们没有看到一个PGError:SSL SYSCALL错误整天。