You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Trenton D. Adams" <tr...@athabascau.ca> on 2005/03/22 23:48:06 UTC

failed to find abandoned connection

dbcp was unable to find our abandoned connections.  The pool slowly 
creeped up to the limit, and then just started failing, instead of 
cleaning up the connections.  I do know that my settings work, because I 
made some of our code not release connections back to the pool, and it 
detected them.  So, why it couldn't find the ones we have in production, 
I don't know.

What makes a connection look like it's been abandoned to the dbcp code?

Any ideas?  I'm getting an exception like this...

Mar 22 14:53:19 MST 2005: Error: attempting to get a free connection.
org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, 
pool exhausted
         at 
org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:183)
         at java.sql.DriverManager.getConnection(DriverManager.java:512)
         at java.sql.DriverManager.getConnection(DriverManager.java:193)
         at ca.montage.banner.db.DBCPPool.getConnection(DBCPPool.java:163)
         at 
ca.montage.banner.db.DBConnectionManager.getConnection(DBConnectionManager.java:204)
         at 
ca.montage.banner.server.RemoteCatalog.getSubjectList(RemoteCatalog.java:39)
         at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
         at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at 
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
         at sun.rmi.transport.Transport$1.run(Transport.java:148)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
         at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:534)
Caused by: java.util.NoSuchElementException
         at 
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:744)
         at 
org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:74)
         at 
org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:175)
         ... 15 more

-- 
Trenton D. Adams
Web Programmer Analyst
Navy Penguins at your service!
Athabasca University
(780) 675-6195
:wq!

__ 
    This communication is intended for the use of the recipient to whom it
    is addressed, and may contain confidential, personal, and or privileged
    information. Please contact us immediately if you are not the intended
    recipient of this communication, and do not copy, distribute, or take
    action relying on it. Any communications received in error, or
    subsequent reply, should be deleted or destroyed.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: failed to find abandoned connection

Posted by "Trenton D. Adams" <tr...@athabascau.ca>.
Well ours works too, if a connection is abandoned in the traditional 
way.  But when it's not, it doesn't work.  And I can't figure out how 
it's not triggering abandoned connections.  Ahhhhhh. :)

Jonathan Cowherd wrote:
> These settings work really well for me:
> 
> initialSize=1
> maxActive=20  // or whatever is appropriate for your db
> minIdle=1
> maxIdle=2
> timeBetweenEvictionRunsMillis=60000
> minEvictableIdleTimeMillis=60000
> 
> Jonathan
> 
> On Tue, 22 Mar 2005 15:48:06 -0700, Trenton D. Adams
> <tr...@athabascau.ca> wrote:
> 
>>dbcp was unable to find our abandoned connections.  The pool slowly
>>creeped up to the limit, and then just started failing, instead of
>>cleaning up the connections.  I do know that my settings work, because I
>>made some of our code not release connections back to the pool, and it
>>detected them.  So, why it couldn't find the ones we have in production,
>>I don't know.
>>
>>What makes a connection look like it's been abandoned to the dbcp code?
>>
>>Any ideas?  I'm getting an exception like this...
>>
>>Mar 22 14:53:19 MST 2005: Error: attempting to get a free connection.
>>org.apache.commons.dbcp.SQLNestedException: Cannot get a connection,
>>pool exhausted
>>         at
>>org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:183)
>>         at java.sql.DriverManager.getConnection(DriverManager.java:512)
>>         at java.sql.DriverManager.getConnection(DriverManager.java:193)
>>         at ca.montage.banner.db.DBCPPool.getConnection(DBCPPool.java:163)
>>         at
>>ca.montage.banner.db.DBConnectionManager.getConnection(DBConnectionManager.java:204)
>>         at
>>ca.montage.banner.server.RemoteCatalog.getSubjectList(RemoteCatalog.java:39)
>>         at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
>>         at
>>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>         at java.lang.reflect.Method.invoke(Method.java:324)
>>         at
>>sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
>>         at sun.rmi.transport.Transport$1.run(Transport.java:148)
>>         at java.security.AccessController.doPrivileged(Native Method)
>>         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
>>         at
>>sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
>>         at
>>sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
>>         at java.lang.Thread.run(Thread.java:534)
>>Caused by: java.util.NoSuchElementException
>>         at
>>org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:744)
>>         at
>>org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:74)
>>         at
>>org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:175)
>>         ... 15 more
>>
>>--
>>Trenton D. Adams
>>Web Programmer Analyst
>>Navy Penguins at your service!
>>Athabasca University
>>(780) 675-6195
>>:wq!
>>
>>__
>>    This communication is intended for the use of the recipient to whom it
>>    is addressed, and may contain confidential, personal, and or privileged
>>    information. Please contact us immediately if you are not the intended
>>    recipient of this communication, and do not copy, distribute, or take
>>    action relying on it. Any communications received in error, or
>>    subsequent reply, should be deleted or destroyed.
>>---
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


-- 
Trenton D. Adams
Web Programmer Analyst
Navy Penguins at your service!
Athabasca University
(780) 675-6195
:wq!

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: failed to find abandoned connection

Posted by Jonathan Cowherd <jp...@gmail.com>.
These settings work really well for me:

initialSize=1
maxActive=20  // or whatever is appropriate for your db
minIdle=1
maxIdle=2
timeBetweenEvictionRunsMillis=60000
minEvictableIdleTimeMillis=60000

Jonathan

On Tue, 22 Mar 2005 15:48:06 -0700, Trenton D. Adams
<tr...@athabascau.ca> wrote:
> dbcp was unable to find our abandoned connections.  The pool slowly
> creeped up to the limit, and then just started failing, instead of
> cleaning up the connections.  I do know that my settings work, because I
> made some of our code not release connections back to the pool, and it
> detected them.  So, why it couldn't find the ones we have in production,
> I don't know.
> 
> What makes a connection look like it's been abandoned to the dbcp code?
> 
> Any ideas?  I'm getting an exception like this...
> 
> Mar 22 14:53:19 MST 2005: Error: attempting to get a free connection.
> org.apache.commons.dbcp.SQLNestedException: Cannot get a connection,
> pool exhausted
>          at
> org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:183)
>          at java.sql.DriverManager.getConnection(DriverManager.java:512)
>          at java.sql.DriverManager.getConnection(DriverManager.java:193)
>          at ca.montage.banner.db.DBCPPool.getConnection(DBCPPool.java:163)
>          at
> ca.montage.banner.db.DBConnectionManager.getConnection(DBConnectionManager.java:204)
>          at
> ca.montage.banner.server.RemoteCatalog.getSubjectList(RemoteCatalog.java:39)
>          at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
>          at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>          at java.lang.reflect.Method.invoke(Method.java:324)
>          at
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
>          at sun.rmi.transport.Transport$1.run(Transport.java:148)
>          at java.security.AccessController.doPrivileged(Native Method)
>          at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
>          at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
>          at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
>          at java.lang.Thread.run(Thread.java:534)
> Caused by: java.util.NoSuchElementException
>          at
> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:744)
>          at
> org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:74)
>          at
> org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:175)
>          ... 15 more
> 
> --
> Trenton D. Adams
> Web Programmer Analyst
> Navy Penguins at your service!
> Athabasca University
> (780) 675-6195
> :wq!
> 
> __
>     This communication is intended for the use of the recipient to whom it
>     is addressed, and may contain confidential, personal, and or privileged
>     information. Please contact us immediately if you are not the intended
>     recipient of this communication, and do not copy, distribute, or take
>     action relying on it. Any communications received in error, or
>     subsequent reply, should be deleted or destroyed.
> ---
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: failed to find abandoned connection

Posted by "Trenton D. Adams" <tr...@athabascau.ca>.
Ok, I'm a total moron.  I was using 
Boolean.getBoolean(dbProperties.getString("removeAbandoned")) instead of 
Boolean.valueOf(
         dbProperties.getString("removeAbandoned")).booleanValue()

I remember doing that code.  And I was thinking to myself, "I don't 
remember the Boolean object ever having a static method that would 
return a primitive type of boolean, that's really odd.  Well, I guess if 
it's there, I might as well use it."

As I'm sure many of you know, most of the primitive data type wrappers, 
such as Integer and Double have a static parse function, which directly 
returns the primitive data type you want, and Boolean does not.

So, the first line of code above was actually returning the system 
property, not the property from the file.

ahhhhhhhhhhhhhhh!!! ROFL

Trenton D. Adams wrote:
> dbcp was unable to find our abandoned connections.  The pool slowly 
> creeped up to the limit, and then just started failing, instead of 
> cleaning up the connections.  I do know that my settings work, because I 
> made some of our code not release connections back to the pool, and it 
> detected them.  So, why it couldn't find the ones we have in production, 
> I don't know.
> 
> What makes a connection look like it's been abandoned to the dbcp code?
> 
> Any ideas?  I'm getting an exception like this...
> 
> Mar 22 14:53:19 MST 2005: Error: attempting to get a free connection.
> org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, 
> pool exhausted
>         at 
> org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:183)
>         at java.sql.DriverManager.getConnection(DriverManager.java:512)
>         at java.sql.DriverManager.getConnection(DriverManager.java:193)
>         at ca.montage.banner.db.DBCPPool.getConnection(DBCPPool.java:163)
>         at 
> ca.montage.banner.db.DBConnectionManager.getConnection(DBConnectionManager.java:204) 
> 
>         at 
> ca.montage.banner.server.RemoteCatalog.getSubjectList(RemoteCatalog.java:39) 
> 
>         at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
> 
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at 
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
>         at sun.rmi.transport.Transport$1.run(Transport.java:148)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
>         at 
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
>         at 
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701) 
> 
>         at java.lang.Thread.run(Thread.java:534)
> Caused by: java.util.NoSuchElementException
>         at 
> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:744) 
> 
>         at 
> org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:74) 
> 
>         at 
> org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:175)
>         ... 15 more
> 


-- 
Trenton D. Adams
Web Programmer Analyst
Navy Penguins at your service!
Athabasca University
(780) 675-6195
:wq!

__ 
    This communication is intended for the use of the recipient to whom it
    is addressed, and may contain confidential, personal, and or privileged
    information. Please contact us immediately if you are not the intended
    recipient of this communication, and do not copy, distribute, or take
    action relying on it. Any communications received in error, or
    subsequent reply, should be deleted or destroyed.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org