Re: Application crashing due to idle connection

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Application crashing due to idle connection
Date: 2014-06-18 06:15:03
Message-ID: 1403072103347-5807690.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

itishree sukla wrote
> Our application is crashing...

It really does help to be more specific with statements of this nature. In
particular:

1) exactly how many idle connections (and are any of them idle in
transaction)? You ran the queries - provide the numbers reported to you.

2) how many connections do you typically have idle when your application is
running versus how many are idle while it is "crashing" (whatever that
actually means in your situation)?

3) does the database continue to work fine and only the application hangs or
does a choked server take down the application with it? Particularly if the
later providing server specs and the relevant PostgreSQL configuration
(especially max connections and memory info) allows people to make better
observations.

> Can any one please give me some clue what cloud be the possible reason

Poorly written application software and/or insufficient connection pooling.

> , and how to get rid of this problem.

(the following are not mutually exclusive)
1. Disconnect from the database when you are not using it.
2. Install a connection pooler (pgbouncer is a good starting point)

> After killing connection this query is also vanishing

What did you expect to happen?

Given the sessions in question are indeed idle the "query" that you are
seeing just happens to be the last one executed.

http://www.postgresql.org/docs/9.3/static/monitoring-stats.html (note the
comments for state and query)

It does seem an unusual query to be leaving for last...though I personally
have no idea what it is doing or if it is PostgreSQL initiated (as opposed
to client-initiated). From your other threads this might be something
PostGIS related - though that would likely fall under "client sent".

Scanning your other recent posts it does seem like you tend to be silent if
the provided advice helps you solve the problem on your own; so for me at
least I'll take silence to mean you figured out how to fix your code and
make use of pgbouncer (or something similar) to solve your scaling need.

Also, as a side comment, the list preference for responses is inline-context
(like mine above) or, second best, bottom-post. Top-posting makes it
difficult for others to following along and catch-up on longer threads.

Good Luck!

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Application-crashing-due-to-idle-connection-tp5807688p5807690.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pujol Mathieu 2014-06-18 08:35:54 GIST optimization to limit calls to operator on sub nodes
Previous Message itishree sukla 2014-06-18 05:27:30 Application crashing due to idle connection