在Heroku,雪松,与独角兽:获取ActiveRecord :: StatementInvalid:PGError:SSL SYSCALL错误:检测到EOF [英] On Heroku, Cedar, with Unicorn: Getting ActiveRecord::StatementInvalid: PGError: SSL SYSCALL error: EOF detected

查看:244
本文介绍了在Heroku,雪松,与独角兽:获取ActiveRecord :: StatementInvalid:PGError:SSL SYSCALL错误:检测到EOF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



基本上,这个错误每隔一段时间就会发生一次(接近部署后),我们已经将每个项目移动到新的Cedar堆栈,并将Unicorn配置为3名工作人员:



错误消息:

  ActiveRecord :: StatementInvalid:PGError:SSL SYSCALL错误:检测到EOF: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

没有来自heroku的回答,除了等待谁知道我们升级共享数据库服务器多久?我还没有在谷歌上找到任何东西。他们还建议它与独角兽的工人重叠,我们应该切换到薄,但性能增益是非常值得的偶尔的错误(我想!)。我希望有一种方法可以配置Unicorn来防止重叠。



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



*不是他们真正的单词,只是他们的反应后感受到的。 / div>

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



附加 config /unicorn.rb

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

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

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.

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:

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.

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.

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.

解决方案

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

Append to your 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.

这篇关于在Heroku,雪松,与独角兽:获取ActiveRecord :: StatementInvalid:PGError:SSL SYSCALL错误:检测到EOF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆