PostgreSQL 15 update

It would seem so. Could you try to follow the steps in this previous post and see if there are any other client connections to the database? Ideally, you should stop any other applications that connect to the database before stopping the app container.

Alternatively, you can try to terminate all established database sessions and quickly stop the postgres service (ideally before the client apps reconnect) then attempt another rebuild after confirming a clean database shutdown from the logs. However, I strongly recommend that you first identify the impact on your client applications listed in pg_stat_activity before terminating their connections.

Here’s a sample command you can run to terminate client connections and stop postgres from inside the app container after stopping nginx and unicorn first.

sudo -u postgres psql -c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE pid <> pg_backend_pid();" && sv stop postgres
3 Likes