[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-user
Subject:    Re: [dbcp] GenericObjectPool.borrowObject: Timeout waiting for idle object
From:       James Carman <james () carmanconsulting ! com>
Date:       2013-09-29 16:46:14
Message-ID: CALznzY6Zk0nFFpTjaUVXm8W5EG13MjMtas1i2SB0hLo-DJL65w () mail ! gmail ! com
[Download RAW message or body]

Try running FindBugs on your code (using something like Sonar or an
IDE plugin).  The rules you're going to be looking for would be these:

http://findbugs.sourceforge.net/bugDescriptions.html#ODR_OPEN_DATABASE_RESOURCE


On Sun, Sep 29, 2013 at 12:41 PM, Phil Steitz <phil.steitz@gmail.com> wrote:
> On 9/29/13 7:13 AM, Bosio Andrea wrote:
>>
>> Hello all,
>>
>> I’m getting the following exception, using commons-dbcp-1.4.
>>
>> Caused by: java.util.NoSuchElementException: Timeout waiting for
>> idle object
>>
>> at
>> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1144)
>> ~[commons-pool-1.5.5.jar:1.5.5]
>>
>> at
>> org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
>> ~[commons-dbcp-1.4.jar:1.4]
>>
>> ... 62 common frames omitted
>>
>> Connections are managed by spring. These are the dbcp config
>> parameters:
>>
>> poolPreparedStatements=true
>>
>> defaultAutoCommit=false
>>
>> driverClassName=oracle.jdbc.driver.OracleDriver
>>
>> validationQuery=select 0 from dual
>>
>> initialSize=1
>>
>> maxActive=15
>>
>> maxIdle=15
>>
>> maxWait=60000
>>
>> removeAbandoned=false
>>
>> removeAbandonedTimeout=300
>>
>> On the database (oracle) I see no active connections when the
>> problem occurs, and sometimes a few inactive connections (5
>> connections).
>>
>> I got an heap dump, and found that the ConnectionPool object
>> (instance of org.apache.commons.pool.impl.GenericObjectPool)
>> numActive variable value is 15, so I understand that the
>> connection pool thinks that there are 15 active connections.
>>
>> I can’t understand why this happen, because on the database there
>> aren’t so many connections.
>>
>> On the heap dump, another thing is strange: the ConnectionPool
>> object variable “pool”, which as far I understand is the list of
>> the connections managed by the pool, contains no element!
>>
>
> The most likely explanation for this is that connections checked out
> from the pool are being abandoned by client threads - i.e., never
> returned via the close() method. The first thing to check is that on
> all code execution paths (including exceptions), the connections
> borrowed from the pool are being closed. You can turn on abandoned
> connection removal and logging to verify that this is not happening.
> If turning on abandoned connection removal makes the problem go
> away, you should still find and fix the code paths that abandon
> connections.
>
> Unless client threads are being interrupted, this will not likely
> fix anything, but you can try upgrading to version 1.5.7 of Commons
> Pool.
>
> Phil
>>
>> Bye,
>> Andrea
>>
>>
>>
>> Andrea Bosio
>> Manager
>>
>> Technology Reply
>> Via Cardinal Massaia, 71
>> 10147 - Torino - ITALY
>> phone: +39 011 29100
>> mobile: +39 348 9504513
>> a.bosio@reply.it
>> www.reply.it
>>
>> Technology Reply
>>
>>
>> --------------------------------------------------------------------
>>
>> --
>> The information transmitted is intended for the person or entity
>> to which it is addressed and may contain confidential and/or
>> privileged material. Any review, retransmission, dissemination or
>> other use of, or taking of any action in reliance upon, this
>> information by persons or entities other than the intended
>> recipient is prohibited. If you received this in error, please
>> contact the sender and delete the material from any computer.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic