« Return to Thread: My connections are all idle...

Re: My connections are all idle...

by Steve Waldman :: Rate this Message:

| View in Thread

Hi,

It sounds like you have a leak, like Connections are occasionally  
being checked out, but not rechecked in (closed).

Try temporarily setting an unreturnedConnectionTimeout and using  
debugUnreturnedConnectionStackTraces to track down the leak.

http://www.mchange.com/projects/c3p0/index.html#unreturnedConnectionTimeout
http://www.mchange.com/projects/c3p0/index.html#debugUnreturnedConnectionStackTraces

Are you carefully using the robust resource clean-up idiom?

> Connection c     = null;
> OtherResource or = null;
>
> try
> {
>    c  = cpds.getConnection();
>    or = getOtherResource()
>
>    // do stuff
>    // ...
> }
> finally
> {
>   try { if (or != null) or.close(); }
>   catch (Exception e) { e.printStackTrace(); }
>
>   try { if (c != null) c.close(); }
>   catch (Exception e) { e.printStackTrace(); }
> }
>
> Note that the finally clause will definitely be executed if the  
> Connection is acquired, and there is a best-attempt close() of each  
> resource: If or fails to close(), that Exception won't prevent the  
> attempt to close() the Connection.


     smiles,
         Steve


On Feb 22, 2010, at 9:28 AM, manugarciac wrote:

>
> Hi, I'm having problems using C3P0's ComboPooledDataSource. My  
> application is
> kinda big, so consider medium to high volumes of clients. The pool of
> connections works well, for days maybe, but sometimes it stops giving
> connections, as if all available connections were in use. However,  
> when I
> check on the DB server (Postgres 8.1) I see all the connections (the  
> same
> number set to maxPoolSize) as "Idle". Not "Idle in transaction", just
> "Idle". What could cause C3P0 not to give this connection to whoever  
> asks
> for a connection on my application?
>
> By the way, I forgot to mention. The DataSource is instantiated when  
> the
> application starts up, and then never closed. Is this the correct  
> way to
> use? I never call a clean up method, as I'm always doing something  
> with the
> DB.
> --
> View this message in context: http://old.nabble.com/My-connections-are-all-idle...-tp27623125p27623125.html
> Sent from the c3p0 - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> c3p0-users mailing list
> c3p0-users@...
> https://lists.sourceforge.net/lists/listinfo/c3p0-users


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
c3p0-users mailing list
c3p0-users@...
https://lists.sourceforge.net/lists/listinfo/c3p0-users

 « Return to Thread: My connections are all idle...