Re: pg_ctl kill QUIT

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: Venkat Balaji <venkat(dot)balaji(at)verse(dot)in>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_ctl kill QUIT
Date: 2012-07-30 11:08:55
Message-ID: 50166B47.3000605@ringerc.id.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/30/2012 05:52 PM, Venkat Balaji wrote:
> Hello Community,
>
> We have used "pg_ctlkill 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Oleg Mürk 2012-07-30 13:51:11 GIN vs GIST multicolumn index
Previous Message Craig Ringer 2012-07-30 10:58:17 Re: password help