Postgresql 12.8 on Ubuntu 20.04.1

This system is running a single java application that talks to the database. Only one user can log into the system (expedite) and only that user runs anything. No external database connections are allowed. I don't have any code that I know of that actually attempts to shutdown postgresql. And yet, about every two to three weeks, it simply stops. The log file is below. I don't even know HOW to send a fast shutdown request!

The system is usually idle when this occurs. I might be logged in but my software is not doing anything at the time, based upon my own logs.

I do have a script that I call when my java code detects that the database is no longer accepting requests. This calls systemctl is-active to see if the service is down or not. Even without any code running (ps -ef lists nothing about postgresql), it says the service is still active. That might be a "feature" of systemctl but...

I'm not a database expert so a pointer to where I can look or a suggestion on how I might track this down would be greatly appreciated. Note that when I restart the database, everything is back up for another 2-3 weeks.

This happens on 4 different systems that are configured the same way, two are VMs, the other two are running on dedicated PCs.

2021-08-14 06:52:30.616 MDT [1436] LOG:  received fast shutdown request
2021-08-14 06:52:30.676 MDT [1436] LOG:  aborting any active transactions
2021-08-14 06:52:30.681 MDT [1092072] expedite@expedite FATAL:  terminating connection due to administrator command
2021-08-14 06:52:30.683 MDT [1436] LOG:  background worker "logical replication launcher" (PID 1533) exited with exit code 1
2021-08-14 06:52:30.685 MDT [1528] LOG:  shutting down
2021-08-14 06:52:30.989 MDT [1436] LOG:  database system is shut down

NOTE: I also looked in the syslog around that date/time and did not see anything unusual.

Thanks in advance!


  • Hey, can you examine what systemd did at the time of these events? If you run journalctl -u postgresql@12-main you should probably see something. You can use --since and --until with journalctl to specify a certain time range. I have a suspicion that this might be due to automatic updates...
    – manamana
    Commented Nov 15, 2021 at 19:25
  • Oh interesting. This takes a long time to run (sometimes weeks) so the next time this happens, I'll check for this. Your suspicion has merit. I have added automatic restarts to my application via a script so I will add the journalctl call at the same time before I restart it. Thanks!
    – Bruce
    Commented Nov 17, 2021 at 14:46


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.