gpt4 book ai didi

ruby-on-rails - Heroku + Rails + PG: ActiveRecord::StatementInvalid (PG::ConnectionBad: PQconsumeInput() SSL 连接意外关闭

转载 作者:行者123 更新时间:2023-11-29 11:15:40 26 4
gpt4 key购买 nike

我在日志中随机且频繁地收到以下错误:

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

可能是因为我的 Pg 计划在 heroku 上的连接限制(我有“Hobby-basic”,它有 20 个连接)?

谢谢

最佳答案

我遇到了完全相同的错误。我也在使用 Heroku Hobby-basic 数据库。我用 Heroku 举了一张票,这是回复:

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.

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.

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!

对我来说,这基本上意味着 Heroku 不关心修复这个错误并希望您升级到 50 美元的数据库。现在我正在运行一个小网站,每天有 4-5 个用户——我还没有办法切换到生产网站。我每天至少遇到 5-6 次您提到的相同错误,但仍未找到解决此问题的方法。尝试将您的数据库切换到另一个共享服务器 - 这对我不起作用。

关于ruby-on-rails - Heroku + Rails + PG: ActiveRecord::StatementInvalid (PG::ConnectionBad: PQconsumeInput() SSL 连接意外关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26792943/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com