pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Old active connections?
4+ messages / 4 participants
[nested] [flat]

* Old active connections?
@ 2018-04-18 00:02  Hans Sebastian <hnsbstn@gmail.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Hans Sebastian @ 2018-04-18 00:02 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hello group,

We run postgresql 10.3 for a python django app with gunicorn on nginx with
django version 1.9.5.

Recently, we started noticing there are many active connections from the
django app server that are more than 1 week old still showing in
pg_stat_activity.

Even though the django server has been stopped (all processes killed), the
active connections still persist. All of these connections are UPDATE
queries that look pretty normal.

Does anyone know the reasons they could be there? What could have caused
them being still active?

This has become an issue as we started getting "FATAL:  remaining
connection slots are reserved for non-replication superuser connections"

Thanks,
-hans

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Old active connections?
@ 2018-04-18 00:08  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Hans Sebastian <hnsbstn@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Adrian Klaver @ 2018-04-18 00:08 UTC (permalink / raw)
  To: Hans Sebastian <hnsbstn@gmail.com>; pgsql-general@lists.postgresql.org

On 04/17/2018 05:02 PM, Hans Sebastian wrote:
> Hello group,
> 
> We run postgresql 10.3 for a python django app with gunicorn on nginx 
> with django version 1.9.5.
> 
> Recently, we started noticing there are many active connections from the 
> django app server that are more than 1 week old still showing in 
> pg_stat_activity.
> 
> Even though the django server has been stopped (all processes killed), 
> the active connections still persist. All of these connections are 
> UPDATE queries that look pretty normal.

Are sure they are coming from Django?

> 
> Does anyone know the reasons they could be there? What could have caused 
> them being still active?

Can we see the data from pg_stat_activity for those queries?

> 
> This has become an issue as we started getting "FATAL:  remaining 
> connection slots are reserved for non-replication superuser connections"
> 
> Thanks,
> -hans
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Old active connections?
@ 2018-04-18 00:11  David G. Johnston <david.g.johnston@gmail.com>
  parent: Hans Sebastian <hnsbstn@gmail.com>
  1 sibling, 1 reply; 4+ messages in thread

From: David G. Johnston @ 2018-04-18 00:11 UTC (permalink / raw)
  To: Hans Sebastian <hnsbstn@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Tue, Apr 17, 2018 at 5:02 PM, Hans Sebastian <hnsbstn@gmail.com> wrote:

> Hello group,
>
> We run postgresql 10.3 for a python django app with gunicorn on nginx with
> django version 1.9.5.​
>

> Recently, we started noticing there are many active connections from the
> django app server that are more than 1 week old still showing in
> pg_stat_activity.
>

​There are quite a few timestamp columns, and a state field, in that view -
you should show some example records instead of leaving people to guess
whether you are presenting an accurate interpretation of the data.

Even though the django server has been stopped (all processes killed), the
> active connections still persist. All of these connections are UPDATE
> queries that look pretty normal.
>
> Does anyone know the reasons they could be there? What could have caused
> them being still active?
>
> This has become an issue as we started getting "FATAL:  remaining
> connection slots are reserved for non-replication superuser connections"
>
>
​Some live process somewhere seems to be keeping an open session with the
PostgreSQL service...
​
Long-lived non-idle statements would likely be waiting for a lock to be
released.

David J.

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Old active connections?
@ 2018-04-18 02:06  Michael Paquier <michael@paquier.xyz>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Paquier @ 2018-04-18 02:06 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Hans Sebastian <hnsbstn@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Tue, Apr 17, 2018 at 05:11:10PM -0700, David G. Johnston wrote:
> Long-lived non-idle statements would likely be waiting for a lock to be
> released.

Be very careful with transactions marked as "idle in transaction" for a
long time.  Long-running transactions prevent VACUUM to do its work as
the oldest XID in view is not updated, causing performance to go down,
and bloat to go up.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2018-04-18 02:06 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18 00:02 Old active connections? Hans Sebastian <hnsbstn@gmail.com>
2018-04-18 00:08 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-04-18 00:11 ` David G. Johnston <david.g.johnston@gmail.com>
2018-04-18 02:06   ` Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox