Thread: pg_ctl kill QUIT

pg_ctl kill QUIT

From
Venkat Balaji
Date:
Hello Community,

We have used "pg_ctl kill QUIT <PID>" to terminate one of the processes on the production database and the database went into recovery mode.

We understand that we should not use "kill -9" and we did not do that.

Could you please help us avoid this problem permanently.

Regards,
Venkat

DISCLAIMER:

Please note that this message and any attachments may contain confidential and proprietary material and information and are intended only for the use of the intended recipient(s). If you are not the intended recipient, you are hereby notified that any review, use, disclosure, dissemination, distribution or copying of this message and any attachments is strictly prohibited. If you have received this email in error, please immediately notify the sender and delete this e-mail , whether electronic or printed. Please also note that any views, opinions, conclusions or commitments expressed in this message are those of the individual sender and do not necessarily reflect the views of Ver sé Innovation Pvt Ltd.

Re: pg_ctl kill QUIT

From
Craig Ringer
Date:
On 07/30/2012 05:52 PM, Venkat Balaji wrote:
Hello Community,

We have used "pg_ctl kill QUIT <PID>" to terminate one of the processes on the production database and the database went into recovery mode.

Did you intend to send SIGTERM (signal 15) instead of SIGQUIT (signal 3)? Signal 3 will be interpreted as a crash, it won't trigger a clean backend shutdown.

If you are using any non-prehistoric version you should always use pg_cancel_backend(...) to end a query, or pg_terminate_backend(...) to ask a backend to terminate, rather than killing processes.

The database is supposed to go into recovery mode if it crashes or terminates unexpectedly, like after a signal 3 (SIGQUIT) to a backend. All the backends are terminated and when it starts back up it does crash recovery then carries on happily.

If that is not what happened, please explain in more detail. Include:

- The text of the PostgreSQL log file from when you sent the signal. This is important. If it's long, put it on pastebin.com or something and link to it here.
- the exact text of any error messages you are getting
- Your postgresql version
- your OS and version
- why you tried to kill a backend / the postmaster / whaterver
- whether you know which process you killed and if so, what it was doing
- what steps you took after you killed the process

See: http://wiki.postgresql.org/wiki/Guide_to_reporting_problems


Here's what should happen, from my 9.1.4 on my Fedora x64 box:

WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
LOG:  server process (PID 19178) exited with exit code 2
LOG:  terminating any other active server processes
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
LOG:  all server processes terminated; reinitializing
LOG:  database system was interrupted; last known up at 2012-07-30 17:22:10 WST
LOG:  database system was not properly shut down; automatic recovery in progress
LOG:  record with zero length at 8/151BB008
LOG:  redo is not required
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections

--
Craig Ringer