PostgreSQL hangs during shut down in linux

postgresql

I m using PostgreSQL 9.0. It hangs during shutdown.
when I used pg_ctl stop it hangs and after sometime its displaying msg:

pg_ctl: server does not shut down

and when I used psql its showing:

psql: FATAL:  the database system is shutting down

and in logs its writing these msgs

 DEBUG:  postmaster received signal 15
2011-07-14 09:36:00 ETC/GMT LOG:  received smart shutdown request

Please tell me how to resolve it?

Best Answer

By default, pg_ctl will attempt a "smart shutdown". This shutdown will tell the system not to accept any new connections, but not shut down until existing ones have disconnected.

You probably want to use "fast" shutdown (by executing pg_ctl -m fast), which will also disconnect existing users.

For Debian (pg_ctl is not by default on $PATH):

pg_ctlcluster 9.4 main restart -m fast