Ruby-on-rails heroku上“PGError:致命:由于管理员命令终止连接”的原因是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5787066/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 00:59:49  来源:igfitidea点击:

What's the cause of "PGError: FATAL: terminating connection due to administrator command" on heroku?

ruby-on-railspostgresqlheroku

提问by James

I have a rails app on heroku that users log in to. I periodically get this exception:

我在 heroku 上有一个用户登录的 rails 应用程序。我定期收到此异常:

UserSessionsController# (ActiveRecord::StatementInvalid) "PGError: FATAL: terminating connection due to administrator command\nserver closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbef...

UserSessionsController# (ActiveRecord::StatementInvalid) "PGError: FATAL: 由于管理员命令终止连接\n服务器意外关闭了连接\n\t这可能意味着服务器异常终止\n\tbef...

URL

网址

POST http://secure.huckberry.com/user_sessions

What's a likely cause of this? I'd appreciate any help.

造成这种情况的可能原因是什么?我很感激任何帮助。

回答by fdr

Assuming you saw this recently, this is due to a recent bit of high-priority maintenance work to enable continuous backups on shared databases -- involving a server restart. You shouldn't worry about this error, provided it does not reproduce. I don't think that's very likely, so happy hacking!

假设您最近看到了这一点,这是由于最近进行了一些高优先级维护工作,以启用对共享数据库的连续备份 - 涉及服务器重新启动。您不必担心此错误,前提是它不会重现。我认为这不太可能,所以很高兴黑客攻击!

回答by Randy Johnson

I had this error happen to me. My Application server had an open connection to the database. In my SSH terminal I added an ipaddress to the ph_hba.conf file and restarted the postgreSQL server.

我有这个错误发生在我身上。我的应用程序服务器有一个到数据库的开放连接。在我的 SSH 终端中,我向 ph_hba.conf 文件添加了一个 ipaddress 并重新启动了 postgreSQL 服务器。

That is when this error showed up. I refreshed my web page one time and the error was gone.

那是这个错误出现的时候。我刷新了我的网页一次,错误消失了。

回答by rmcc

This probably means that something sent the server process a SIGTERM signal. This could happen is if the postmaster gets a SIGINTfrom something. However, if you are able to reconnect that's not the case, because the postmaster would disallow new connections.

这可能意味着某些东西向服务器进程发送了一个 SIGTERM 信号。这可能发生在邮局局长从某物获得SIGINT 的情况下。但是,如果您能够重新连接,则情况并非如此,因为 postmaster 将禁止新连接。

You're probably having a clash of some kind in your application. Enable query loggingand check for something unusual.

您的应用程序中可能存在某种冲突。启用查询日志记录并检查异常情况。