3

My PostgreSQL server unexpectedly restarted with such messages:

2017-08-16 03:44:34 GMT LOG:  received fast shutdown request
2017-08-16 03:44:34 GMT LOG:  aborting any active transactions
2017-08-16 03:44:34 GMT FATAL:  terminating connection due to administrator command
2017-08-16 03:44:34 GMT FATAL:  terminating connection due to administrator command
2017-08-16 03:44:34 GMT LOG:  autovacuum launcher shutting down
2017-08-16 03:44:34 GMT LOG:  shutting down
2017-08-16 03:44:34 GMT LOG:  database system is shut down
2017-08-16 03:46:04 GMT LOG:  incomplete startup packet
2017-08-16 03:46:04 GMT LOG:  database system was shut down at 2017-08-16 03:44:34 GMT
2017-08-16 03:46:04 GMT LOG:  MultiXact member wraparound protections are now enabled
2017-08-16 03:46:04 GMT LOG:  database system is ready to accept connections
2017-08-16 03:46:04 GMT LOG:  autovacuum launcher started

what could be the reason?

Configuration details:

OS: Ubuntu 16.04.1 LTS (Windows Azure VM)
PostgreSQL version: 9.5.8
listen address: * (my bad, but Azure have to block another ports from external access.
                   I didn't enable PG 5432 port for external access) 
HBA config:
local   all             postgres                                ident
host    all             all             127.0.0.1/32            md5
host    all             all             ::1/128                 md5
host    all             all             10.0.0.0/24             md5
host    replication     app_replicator 10.0.0.5/32              md5
local   all             all                                     peer
  • Have you gone through this dba.stackexchange.com/questions/87622/… – Md Haidar Ali Khan Aug 16 '17 at 13:54
  • Thanks, I read it. But I think that only common detail between issues is "incomplete startup packet" message. It's strange message but I'm more worried about database restart. – Pavel Naydenov Aug 16 '17 at 14:12
  • Did the server itself restart, or just Postgres? If the latter, did a Postgresql version upgrade occur? – bma Aug 16 '17 at 14:54
  • Only Postgres restarted. I did't invoke postgresql update by hand if you asked about it. – Pavel Naydenov Aug 16 '17 at 16:10
3

2017-08-16 03:44:34 GMT LOG: received fast shutdown request

Someone did a pg_ctl -m fast stop then pg_ctl start, either manually or via the Windows service controller (services.msc, net service, ...).

If it wasn't you, it was a scheduled job, automatic update for some tool related to PostgreSQL from some unofficial 3rd party, etc. Because unless your system got hit by the most mystically lucky cosmic ray in history, that's what happened.

There's no way to restart PostgreSQL from within the PostgreSQL SQL environment (a SQL connection via PgAdmin, psql, etc). You could do it by sending a signal from an untrusted procedural language like plpythonu or plperlu if you're connected as the database superuser and these languages are installed. But otherwise it'd be done at the command-shell level with pg_ctl, by signalling the postmaster process, etc.

  • Does PostgreSQL has ability to initiate its restart by himself? – Pavel Naydenov Aug 17 '17 at 6:40
  • 1
    @CraigRinger I think it was probably separate pg_ctl -mf stop and pg_ctl start commands, not a single restart, based on the 1.5 minutes between them. – jjanes Aug 17 '17 at 16:38
  • @jjanes Agreed, I misread the timestamps. – Craig Ringer Aug 18 '17 at 1:34
  • @CraigRinger Could you incorporate your longer comment into your Answer? That's a very interesting point. – Basil Bourque Aug 18 '17 at 6:09
  • Done and fixed restart too – Craig Ringer Aug 18 '17 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.