BUG #4834: "pg_ctl stop -m fast" fails to stop database - Mailing list pgsql-bugs

From Aleksey Tsalolikhin
Subject BUG #4834: "pg_ctl stop -m fast" fails to stop database
Date
Msg-id 200906021955.n52Jt9ED008199@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4834: "pg_ctl stop -m fast" fails to stop database
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4834
Logged by:          Aleksey Tsalolikhin
Email address:      aleksey.tsalolikhin@gmail.com
PostgreSQL version: 8.3.7
Operating system:   CentOS 5.2
Description:        "pg_ctl stop -m fast" fails to stop database
Details:

"pg_ctl stop -m fast" fails to stop database when idle clients are
connected.  It fails to disconnect the idle clients.

Here is an example:

I have idle clients connected.

I try to stop the server using "pg_ctl stop -m fast", but it fails.

When I manually kill the postgres processes handling the idle clients, the
database exits.


[postgres@hwd-ddc-sonydb-prod ~]$ ps ax|grep postgres
 2873 ?        S      0:01 /usr/local/pgsql/bin/postgres -D
/usr/local/pgsql/data
 2877 ?        Ss     0:00 postgres: writer process
 2880 ?        Ss     0:31 postgres: stats collector process
16261 ?        Ss     0:00 postgres: user1 db1 10.10.10.135(50670) idle
18758 ?        Ss     0:00 postgres: user2 db2 10.10.10.135(33371) idle
18763 ?        Ss     0:00 postgres: user1 db1 10.10.10.135(33572) idle
21393 ?        Ss     0:00 postgres: user1 db1 10.10.10.135(44450) idle
21402 ?        Ss     0:00 postgres: user1 db1 10.10.10.135(45766) idle
22746 ?        Ss     0:00 postgres: user1 db1 10.10.10.135(34241) idle
25009 pts/2    S      0:00 su - postgres
25039 pts/2    R+     0:00 grep postgres
[postgres@hwd-ddc-sonydb-prod ~]$ PGDATA=/usr/local/pgsql/data
/usr/local/pgsql/bin/pg_ctl stop -m fast
waiting for server to shut
down............................................................... failed
pg_ctl: server does not shut down
[postgres@hwd-ddc-sonydb-prod ~]$ ps ax|grep postgres
 2873 ?        S      0:01 /usr/local/pgsql/bin/postgres -D
/usr/local/pgsql/data
 2877 ?        Ss     0:00 postgres: writer process
 2880 ?        Ss     0:31 postgres: stats collector process
16261 ?        Ss     0:00 postgres: user1 db1 10.10.10.135(50670) idle
18758 ?        Ss     0:00 postgres: user2 db2 10.10.10.135(33371) idle
18763 ?        Ss     0:00 postgres: user1 db1 10.10.10.135(33572) idle
21393 ?        Ss     0:00 postgres: user1 db1 10.10.10.135(44450) idle
21402 ?        Ss     0:00 postgres: user1 db1 10.10.10.135(45766) idle
22746 ?        Ss     0:00 postgres: user1 db1 10.10.10.135(34241) idle
25009 pts/2    S      0:00 su - postgres
25074 pts/2    R+     0:00 grep postgres
[postgres@hwd-ddc-sonydb-prod ~]$



Postgres would not exit until I killed the processes corresponding to the
"idle" clients.

Then all the remaining database processes exited.


[postgres@hwd-ddc-sonydb-prod log]$ kill 16261
[postgres@hwd-ddc-sonydb-prod log]$ kill 18763
[postgres@hwd-ddc-sonydb-prod log]$ kill 18758 21393 21402 22746
[postgres@hwd-ddc-sonydb-prod log]$ ps ax|grep postgres
25009 pts/2    S      0:00 su - postgres
25084 pts/2    R+     0:00 grep postgres
[postgres@hwd-ddc-sonydb-prod log]$


From pg_ctl man page:

       ‘‘Fast’’  mode  does not wait for clients to disconnect. All
active transactions
       are rolled back and clients are forcibly disconnected, then the
server  is  shut
       down.

Looks like the forcible disconnect did not work.

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: BUG #4809: Missing Expected Operator
Next
From: Tom Lane
Date:
Subject: Re: BUG #4834: "pg_ctl stop -m fast" fails to stop database