Thread: PG_TERMINATE_BACKEND not working.

PG_TERMINATE_BACKEND not working.

From
Harry
Date:
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.


Re: PG_TERMINATE_BACKEND not working.

From
Craig Ringer
Date:
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



Re: PG_TERMINATE_BACKEND not working.

From
Chris Angelico
Date:
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


Re: PG_TERMINATE_BACKEND not working.

From
Harry
Date:
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.


Re: PG_TERMINATE_BACKEND not working.

From
Raghavendra
Date:
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

 

Re: PG_TERMINATE_BACKEND not working.

From
dinesh kumar
Date:
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,

Re: PG_TERMINATE_BACKEND not working.

From
"byfei163@163.com"
Date:
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.