PG_TERMINATE_BACKEND not working.

Started by Harryover 13 years ago7 messagesgeneral
Jump to latest
#1Harry
shirlekar.harshal@gmail.com

I am facing problem i.e. connections after execution completed are residing
in pg_stat_activity and pg_stat_database.
but when i am trying to kill them manually using pg_terminate_backend (All
IDLE connections are getting killed but, others like declare, select etc.)
are not getting killed getting result false.
Kindly help to resolve this issue.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/PG-TERMINATE-BACKEND-not-working-tp5732379.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

#2Craig Ringer
craig@2ndquadrant.com
In reply to: Harry (#1)
Re: PG_TERMINATE_BACKEND not working.

On 11/16/2012 02:34 PM, Harry wrote:

I am facing problem i.e. connections after execution completed are residing
in pg_stat_activity and pg_stat_database.
but when i am trying to kill them manually using pg_terminate_backend (All
IDLE connections are getting killed but, others like declare, select etc.)
are not getting killed getting result false.
Kindly help to resolve this issue.

More detail is needed.

Pg version?

OS and version?

Exact command output?

What the queries that're not terminated are doing?

Why you're terminating them / what problem you're trying to solve?

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

#3Chris Angelico
rosuav@gmail.com
In reply to: Craig Ringer (#2)
Re: PG_TERMINATE_BACKEND not working.

On Sun, Nov 18, 2012 at 10:25 PM, Craig Ringer <craig@2ndquadrant.com> wrote:

On 11/16/2012 02:34 PM, Harry wrote:

I am facing problem i.e. connections after execution completed are residing
in pg_stat_activity and pg_stat_database.
but when i am trying to kill them manually using pg_terminate_backend (All
IDLE connections are getting killed but, others like declare, select etc.)
are not getting killed getting result false.
Kindly help to resolve this issue.

More detail is needed.

Pg version?

OS and version?

Exact command output?

What the queries that're not terminated are doing?

Why you're terminating them / what problem you're trying to solve?

And: Are you logged in as superuser when you try to kill them, and if
not, are the other sessions from your own user?

ChrisA

#4Harry
shirlekar.harshal@gmail.com
In reply to: Chris Angelico (#3)
Re: PG_TERMINATE_BACKEND not working.

Chris Yes, i am logging in as Super User also, other side same user's
connection(Superuser) i am trying to kill.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/PG-TERMINATE-BACKEND-not-working-tp5732379p5732694.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

#5Raghavendra
raghavendra.rao@enterprisedb.com
In reply to: Harry (#4)
Re: PG_TERMINATE_BACKEND not working.

n Mon, Nov 19, 2012 at 10:52 AM, Harry <shirlekar.harshal@gmail.com> wrote:

Chris Yes, i am logging in as Super User also, other side same user's
connection(Superuser) i am trying to kill.

Can you give a try, by picking the IP's of the processes which are not
getting killed from pg_stat_activity(client_addr column) and make REJECT
entries in pg_hba.conf file as below:

host all all <client_addr IP> reject

and reload the cluster using pg_ctl -D $PGDATA reload

Now try killing the process

pg_ctl kill TERM <Process PID>

---
Regards,
Raghavendra
EnterpriseDB Corporation
Blog: http://raghavt.blogspot.com/

#6dinesh kumar
dineshkumar02@gmail.com
In reply to: Raghavendra (#5)
Re: PG_TERMINATE_BACKEND not working.

Hi Harry,

As you reported "pg_terminate_backend(pid)" returning "f" when executing.
Please confirm are u getting any error like below .

postgres=# select pg_terminate_backend(342033);
WARNING: PID 342033 is not a PostgreSQL server process
pg_terminate_backend
----------------------
f
(1 row)

Not sure, what kind of error your are getting while executing it. So,
requesting you to share your postgresql version, command what you have
executed and it's result. However, pg_terminate_backend() is responsible to
send "SIGTERM" to it's OS process. From there onwards, OS will take care
about the given process termination.

Can you give a try, by picking the IP's of the processes which are not

getting killed from pg_stat_activity(client_addr column) and make REJECT
entries in pg_hba.conf file as below:

host all all <client_addr IP> reject

and reload the cluster using pg_ctl -D $PGDATA reload

Now try killing the process

pg_ctl kill TERM <Process PID>

I am not sure why we are rejecting the incoming connections here.

Regards,
Dinesh
manojadinesh.blogspot.com

#7byfei163@163.com
byfei163@163.com
In reply to: Harry (#1)
Re: PG_TERMINATE_BACKEND not working.

Then same problem with you,and any idea?

--
View this message in context: http://postgresql.1045698.n5.nabble.com/PG-TERMINATE-BACKEND-not-working-tp5732379p5812909.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general