Unix Technical Forum

Re: Applications that leak connections

This is a discussion on Re: Applications that leak connections within the Pgsql General forums, part of the PostgreSQL category; --> you are perfectly right, fixing the source of the problem is the best way to fix this. i always ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 08:20 PM
Jonel Rienton
 
Posts: n/a
Default Re: Applications that leak connections

you are perfectly right, fixing the source of the problem is the best way to
fix this. i always make it a habit to close my connections as soon as i'm
done with it. if foxpro won't do it for you, you have to manage your own
resources, always a good practice for unmanaged applications.

i suggest you parse your code for all lines that opens the connection and
close it where it's not needed anymore.

good luck.

regards,


On Thu, 03 Feb 2005 18:27:46 -0500, Paul Tillotson wrote
> Does anyone have any useful info about dealing with applications
> which "leak" connections, eventually causing "connection limit
> exceeded for non superusers?"
>
> Obviously fixing the app is the best choice, but I have a feeling
> that this is going to recur again and again since the app is poorly
> maintained but still under active development (code base too large
> for the developer assigned to it). The developer is likely to
> accidentally cause connection leaks in the future.
>
> This problem is also very easy to cause because doing this:
>
> c = sqlconnect("database")
> c = sqlconnect("database")
>
> Causes TWO connections to be made, and the first connection made is
> now
> (as far as I can see) impossible to close without closing the
> application. The language (Visual Foxpro) does not garbage collect
> connections and so any connection whose handle is lost still takes
> up one of the slots.
>
> On the server side, I can detect this condition using ps -A or lsof;
> but I have not thought of a good solution to use when this is
> noticed. One possibility is to just shut down the database and
> restart it when this happens. I did some research into finding out
> if it was possible to break a specific TCP connection (this is linux
> 2.6 kernel--platform specific tools/commands ok). For example,
> could I use hping to break the connections?
>
> Does anyone know a safe way to shutdown just one backend (if it is
> idle)?
>
> Another possibility that I can think of is per ip address connection
> limits. How hard would that be?
>
> Paul Tillotson
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>
> (send "unregister YourEmailAddressHere" to
> majordomo@postgresql.org)



--
Jonel Rienton
http://blogs.road14.com
Software Developer, *nix Advocate


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

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:22 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com