“PGError:FATAL:由于管理员命令而终止连接”的原因是什么?在赫罗库上?
我在 Heroku 上有一个 Rails 应用程序,用户可以登录。我定期收到此异常:
用户会话控制器# (ActiveRecord::语句无效) “PGError:FATAL:正在终止 由于管理员的连接 命令\n服务器关闭连接 出乎意料\n\t这可能意味着 服务器终止 异常\n\tbef...
URL
POST http://secure.huckberry.com/user_sessions
可能的原因是什么?我将不胜感激任何帮助。
I have a rails app on heroku that users log in to. I periodically get this exception:
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...
URL
POST http://secure.huckberry.com/user_sessions
What's a likely cause of this? I'd appreciate any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
假设您最近看到了这一点,这是由于最近进行了一些高优先级维护工作,以启用共享数据库的连续备份 - 涉及服务器重新启动。您不必担心此错误,只要它不会重现即可。我认为这不太可能,祝黑客快乐!
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!
这可能意味着某些东西向服务器进程发送了 SIGTERM 信号。如果 postmaster 从某处收到 SIGINT ,则可能会发生这种情况。但是,如果您能够重新连接,则情况并非如此,因为邮局管理员将不允许新连接。
您的应用程序中可能存在某种冲突。启用查询日志记录并检查是否有异常情况。
This probably means that something sent the server process a SIGTERM signal. This could happen is if the postmaster gets a SIGINT from something. However, if you are able to reconnect that's not the case, because the postmaster would disallow new connections.
You're probably having a clash of some kind in your application. Enable query logging and check for something unusual.
我遇到了这个错误。我的应用程序服务器与数据库有一个开放的连接。在我的 SSH 终端中,我向 ph_hba.conf 文件添加了一个 IP 地址并重新启动了 postgreSQL 服务器。
这就是这个错误出现的时候。我刷新了一次网页,错误就消失了。
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.
That is when this error showed up. I refreshed my web page one time and the error was gone.
如果您运行使用数据库连接(本例中为 PSQL)的测试套件并且测试仍在运行(异步),也可能会出现此错误。
当测试仍在运行时,拆卸钩子可能会终止连接,并导致此错误消息。
This error may also appear, if you run a test suite which utilizes a database connection (PSQL in this case) and the test is still running (asynchronously).
A tear down hook may terminate the connection when the test is still running and this ends up in this error message.
这也可能是由于 PostgreSQL 接收无人值守升级(Ubuntu 上的
/var/log/apt/history.log
)引起的 - 在 PostgreSQL 的日志中,您将看到This can also be caused by PostgreSQL receiving an unattended upgrade (
/var/log/apt/history.log
on Ubuntu) - in PostgreSQL's logs you will see在这里对我有用的解决方案就是简单地清理我臃肿的桌子。
您还可以为您的数据库关闭 autoVaccum,但我不推荐这样做,因为它会对您的数据库性能产生巨大的负面影响。
The solution that worked for me here was simply to vaccum my bloated tables.
You can also turn autoVaccum off for your db, but i would NOT RECOMMEND this as it can have a massive negative impact on your DB performance.