Home > Archive > PostgreSQL Administration > November 2006 > Issue with processes open for clients









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Issue with processes open for clients
jose fuenmayor

2006-11-09, 7:22 pm

Hi all , I have a question or a doubt, when I ran psql remotely it opens a
process on the server, so I issue a query (select count(*) from
80millionsrowstable)
then I can see that process taking cpu and mem from the
server (using top), then I cancel the psql on the client, I expect to see
that process gone but that is not the case it is still there! and taking
resources!.

When I cancelled the query issued by the client is not supposed to eliminate
the process open for him on the server?

The process stays hanging there?
why is that?.
Is there any parameter on postgresql or the operating system that can tune?
I am using mandriva linux free 2006
kernel 2.6.12
Postgresql 8.0.8
phpPgAdmin 4.0.1 (running in a web server whit php module 5.0.4)

Same thing using phpPgAdmin

Thanks in advance! I really aprecciate your help!

Shoaib Mir

2006-11-10, 5:29 am

If you don't need the client connection after query has executed then just
close that client connection or you can have it set in your firewall to kill
such idle connections who are not doing anything.

Thanks,
--------
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On 11/10/06, jose fuenmayor <jafn82@gmail.com> wrote:
>
> Hi all , I have a question or a doubt, when I ran psql remotely it opens a
> process on the server, so I issue a query (select count(*) from
> 80millionsrowstable)
then I can see that process taking cpu and mem from the
> server (using top), then I cancel the psql on the client, I expect to see
> that process gone but that is not the case it is still there! and taking
> resources!.
>
> When I cancelled the query issued by the client is not supposed to
> eliminate the process open for him on the server?
>
> The process stays hanging there?
> why is that?.
> Is there any parameter on postgresql or the operating system that can
> tune?
> I am using mandriva linux free 2006
> kernel 2.6.12
> Postgresql 8.0.8
> phpPgAdmin 4.0.1 (running in a web server whit php module 5.0.4)
>
> Same thing using phpPgAdmin
>
> Thanks in advance! I really aprecciate your help!
>


jose fuenmayor

2006-11-10, 7:24 pm

Ok but what can i do with that information?

On 11/10/06, Shoaib Mir <shoaibmir@gmail.com> wrote:
>
> Check pg_stat_activity for any queries that are in execution mode, where
> command_query will give you the query and you will also get the process ids
> for them in pg_stat_activity.
>
> Thanks,
> -------
> Shoaib Mir
> EnterpriseDB (www.enterprisedb.com)
>
> On 11/10/06, jose fuenmayor <jafn82@gmail.com > wrote:
>


imad

2006-11-10, 7:24 pm

I found it on postgresql archives:
http://archives.postgresql.org/pgsq...09/msg00261.php

This post was by Tom Lane, I hope this is what you want.

It will time out by itself eventually (order of a couple hours probably
--- it depends on your TCP stack). You can try a SIGINT or SIGTERM.
SIGINT is safe but may or may not cause the backend to quit. SIGTERM
will make it quit, but I'm not prepared to guarantee that SIGTERM won't
have bad side effects. I'd suggest waiting...



--Imad
www.EnterpriseDB.com


On 11/11/06, jose fuenmayor <jafn82@gmail.com> wrote:
> Ok but what can i do with that information?
>
> On 11/10/06, Shoaib Mir <shoaibmir@gmail.com> wrote:
> command_query will give you the query and you will also get the process ids
> for them in pg_stat_activity.
> or kill the client that he is using when this query has not finished, then
> the process in the server is not killed still there taking resources, it
> happens with some clients (psql, phpPgAdmin), how can I configurate the
> firewall to elminate idle connections? will this eliminate all conections
> that are not doing anything?, because in my case the client is killed but
> the process in the server for that client not and continues taking
> resources.
> just close that client connection or you can have it set in your firewall to
> kill such idle connections who are not doing anything.
> opens a process on the server, so I issue a query (select count(*) from
> 80millionsrowstable)
then I can see that process taking cpu and mem from the
> server (using top), then I cancel the psql on the client, I expect to see
> that process gone but that is not the case it is still there! and taking
> resources!.
> eliminate the process open for him on the server?
> can tune?
>
>


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Simon Riggs

2006-11-10, 7:24 pm

On Thu, 2006-11-09 at 19:54 +0000, jose fuenmayor wrote:
> Hi all , I have a question or a doubt, when I ran psql remotely it
> opens a process on the server, so I issue a query (select count(*)
> from 80millionsrowstable)
then I can see that process taking cpu and
> mem from the server (using top), then I cancel the psql on the client,
> I expect to see that process gone but that is not the case it is still
> there! and taking resources!.
>
> When I cancelled the query issued by the client is not supposed to
> eliminate the process open for him on the server?


If you quit psql, then the server may not realise you have disconnected.
You need to issue a cancel, so that can be communicated to the server so
it knows to quit.

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com



---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

jose fuenmayor

2006-11-13, 7:20 pm

Thanks for your answer!
How can i issue a cancel?
thanks in advance!
On 11/10/06, Simon Riggs <simon@2ndquadrant.com> wrote:
>
> On Thu, 2006-11-09 at 19:54 +0000, jose fuenmayor wrote:
>
> If you quit psql, then the server may not realise you have disconnected.
> You need to issue a cancel, so that can be communicated to the server so
> it knows to quit.
>
> --
> Simon Riggs
> EnterpriseDB http://www.enterprisedb.com
>
>
>


adey

2006-11-13, 7:20 pm

Is there not a parameter in Postgres to timeout idle connections?

On 11/11/06, imad <immaad@gmail.com> wrote:
>
> I found it on postgresql archives:
> http://archives.postgresql.org/pgsq...09/msg00261.php
>
> This post was by Tom Lane, I hope this is what you want.
>
> It will time out by itself eventually (order of a couple hours probably
> --- it depends on your TCP stack). You can try a SIGINT or SIGTERM.
> SIGINT is safe but may or may not cause the backend to quit. SIGTERM
> will make it quit, but I'm not prepared to guarantee that SIGTERM won't
> have bad side effects. I'd suggest waiting...
>
>
>
> --Imad
> www.EnterpriseDB.com
>
>
> On 11/11/06, jose fuenmayor <jafn82@gmail.com> wrote:
> where
> ids
> query
> then
> conections
> but
> then
> firewall to
> it
> the
> see
> to
> that
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com