“PGError:FATAL:由于管理员命令而终止连接”的原因是什么?在赫罗库上?

发布于 2024-11-03 02:41:07 字数 320 浏览 1 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

昵称有卵用 2024-11-10 02:41:07

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

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!

等待圉鍢 2024-11-10 02:41:07

这可能意味着某些东西向服务器进程发送了 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.

以往的大感动 2024-11-10 02:41:07

我遇到了这个错误。我的应用程序服务器与数据库有一个开放的连接。在我的 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.

半世晨晓 2024-11-10 02:41:07

如果您运行使用数据库连接(本例中为 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.

审判长 2024-11-10 02:41:07

这也可能是由于 PostgreSQL 接收无人值守升级(Ubuntu 上的 /var/log/apt/history.log)引起的 - 在 PostgreSQL 的日志中,您将看到

2023-08-18 06:29:57 UTC LOG:  received fast shutdown request
2023-08-18 06:29:57 UTC LOG:  aborting any active transactions
2023-08-18 06:29:57 UTC FATAL:  terminating connection due to administrator command

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

2023-08-18 06:29:57 UTC LOG:  received fast shutdown request
2023-08-18 06:29:57 UTC LOG:  aborting any active transactions
2023-08-18 06:29:57 UTC FATAL:  terminating connection due to administrator command
℡寂寞咖啡 2024-11-10 02:41:07

在这里对我有用的解决方案就是简单地清理我臃肿的桌子。

您还可以为您的数据库关闭 autoVaccum,但我不推荐这样做,因为它会对您的数据库性能产生巨大的负面影响。

VACUUM FULL VERBOSE ANALYZE <table_name>;

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.

VACUUM FULL VERBOSE ANALYZE <table_name>;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文