Heroku上的Rails + + PG:的ActiveRecord :: StatementInvalid(PG :: ConnectionBad:PQconsumeInput()SSL连接已经被意外关闭 [英] Heroku + Rails + PG: ActiveRecord::StatementInvalid (PG::ConnectionBad: PQconsumeInput() SSL connection has been closed unexpectedly

查看:316
本文介绍了Heroku上的Rails + + PG:的ActiveRecord :: StatementInvalid(PG :: ConnectionBad:PQconsumeInput()SSL连接已经被意外关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到随机非常频繁在我的日志中出现以下错误:

I am receiving randomly and very frequently the following error in my logs:

Nov 06 05:31:21 lmrapp app/web.2:  [wbinternacional] [0f0965e3-e537-4aed-8f3e-311a222e8fa1] PG::ConnectionBad: PQconsumeInput() SSL connection has been closed unexpectedly 
Nov 06 05:31:21 lmrapp app/web.2:  [wbinternacional] [0f0965e3-e537-4aed-8f3e-311a222e8fa1] Completed 500 Internal Server Error in 23ms 
Nov 06 05:31:21 lmrapp app/web.2:  FATAL:  terminating connection due to administrator command 
Nov 06 05:31:21 lmrapp app/web.2:  ActiveRecord::StatementInvalid (PG::ConnectionBad: PQconsumeInput() SSL connection has been closed unexpectedly 

难道是由于在Heroku我的PG计划的连接数限制(我有的业余爱好 - 基本的有20个连接)?

Could it be due to the Connection limit of my Pg plan on heroku (I have "Hobby-basic" which have 20 connections)?

感谢

推荐答案

我收到完全相同的错误。我也是在Heroku的业余爱好 - 基本分贝。我提出与Heroku的一票,这里曾是响应:

I'm getting the exact same error. I also am on a Heroku Hobby-basic db. I raised a ticket with Heroku, here was the response:

在SSL连接已经被意外关闭的错误(和一些类似的)是一个客户端错误,表示你的数据库连接已经消失。之一的嗜好层数据库的局限性是不通知维护。我们有时需要关闭一些连接爱好层的数据库,当我们做到这一点,该应用程序会经常看到像这样的错误。

The "SSL connection has been closed unexpectedly" error (and a few similar ones) is a client-side error indicating your database connection has gone away. One of the limitations of the hobby tier databases is unannounced maintenance. We will occasionally need to close some connections to hobby tier databases, and when we do that, the app will often see an error like this one.

这是维护一个连接池(比如ActiveRecord在Rails中)可以打开到数据库的新连接大多数的应用程序。然而,在某些情况下,一个应用程序将不能重新连接。如果出现这种情况,你可以Heroku的重新启动赛道获得一个新的进程上一个新的运行。

Most apps that maintain a connection pool (like ActiveRecord in Rails) can just open a new connection to the database. However, in some cases an app won't be able reconnect. If that happens, you can heroku restart that dyno to get a new process on a new runtime.

在生产环境中运行的爱好层的数据库一般不建议使用。如果你要,但是,它的配置你的应用程序有利于在重复的数据库连接错误,实际上崩溃的方式,它会开始一个新的运行时会自动将新的连接池。

Running hobby tier databases in production isn't generally recommended. If you're going to, though, it's helpful to configure your app to actually crash on repeated database connection errors—that way, it will start on a new runtime with a new connection pool automatically.

这看起来是这样的情况已经发生了很多给你,虽然, INT这种情况下,我建议一个 <一个href="https://devcenter.heroku.com/articles/upgrading-heroku-postgres-databases#upgrade-with-pgbackups-transfer-default">pgbackups:transfer到数据库移动到另一台共享服务器。请记住,爱好层规则适用于$ 9个基本计划,以及免费的数据库。让我知道,如果你有任何问题。谢谢!

It looks like this has been happening a lot to you, though; int that case, I'd recommend a pgbackups:transfer to move the database to another shared server. Keep in mind that hobby tier rules apply to the $9 basic plan as well as the free database. Let me know if you have any further questions. Thanks!

要我来说,这基本上意味着He​​roku的不小心把解决这个错误,并希望您升级到$ 50个数据库。现在,我正在一个小的网站,在这里我得到4-5的用户/天 - 也没有办法,我想切换到生产现场的呢。我得到你提到的至少5-6次/天,同样的错误,还没有想出一个办法来解决这个问题。尝试切换你的数据库到另一台共享服务器 - 这并没有为我工作。

To me this basically means Heroku doesn't care to fix this error and wants you to upgrade to the $50 database. Now I'm running a small site where I get 4-5 users/day - there is no way I want to switch to a production site as of yet. I am getting the same error you mentioned at least 5-6 times/day and still haven't figured out a way to fix this. Try switching your db to another shared server - this does not work for me.

这篇关于Heroku上的Rails + + PG:的ActiveRecord :: StatementInvalid(PG :: ConnectionBad:PQconsumeInput()SSL连接已经被意外关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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