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

67,013

Solution 1

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!

Solution 2

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.

Solution 3

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.

Solution 4

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.

Share:
67,013
James
Author by

James

Updated on September 13, 2021

Comments

  • James
    James over 2 years

    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.