You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Ashish Chaudhary <as...@gmail.com> on 2014/10/01 10:46:32 UTC

[pool]

I am getting this error  *"INFO: Maximum number of threads (200) created
for connector with address null and port 8080"*  on prod in approximately
every 7-8 days. So to debug this issue I downloaded the thread dump file.
This file has following thread state 100 times:

"http-8080-198" daemon prio=10 tid=0x08a62c00 nid=0x3a78 in Object.wait()
[0x66467000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x87097728> (a
org.apache.commons.pool.impl.GenericObjectPool$Latch)
    at java.lang.Object.wait(Object.java:485)
    at
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1104)
    - locked <0x87097728> (a
org.apache.commons.pool.impl.GenericObjectPool$Latch)

My understanding is that there is some memory leak or the connection
objects are not enough and because of this every call waits for new MySQL
connection from the pool and it just hangs there and the thread associated
with this MySQL call also waits. And this leads to this issue *"INFO:
Maximum number of threads (200) created for connector with address null and
port 8080"*

So my questions are:

    Is this exception because of mysql connection pool? If yes, what should
I do to solve it? My MAX-Active value is 50 and MinIdle value is 1.

    If this is not the case then how can I know which functionality are
holding threads?

Note: I'm not closing ResultSet, I'm closing only Statement and Connection
can this might be the issue.

Re: [pool]

Posted by Gary Gregory <ga...@gmail.com>.
Have you tried pool2?

Gary

On Wed, Oct 1, 2014 at 4:46 AM, Ashish Chaudhary <
ashishchaudhary.j@gmail.com> wrote:

> I am getting this error  *"INFO: Maximum number of threads (200) created
> for connector with address null and port 8080"*  on prod in approximately
> every 7-8 days. So to debug this issue I downloaded the thread dump file.
> This file has following thread state 100 times:
>
> "http-8080-198" daemon prio=10 tid=0x08a62c00 nid=0x3a78 in Object.wait()
> [0x66467000]
>    java.lang.Thread.State: WAITING (on object monitor)
>     at java.lang.Object.wait(Native Method)
>     - waiting on <0x87097728> (a
> org.apache.commons.pool.impl.GenericObjectPool$Latch)
>     at java.lang.Object.wait(Object.java:485)
>     at
>
> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1104)
>     - locked <0x87097728> (a
> org.apache.commons.pool.impl.GenericObjectPool$Latch)
>
> My understanding is that there is some memory leak or the connection
> objects are not enough and because of this every call waits for new MySQL
> connection from the pool and it just hangs there and the thread associated
> with this MySQL call also waits. And this leads to this issue *"INFO:
> Maximum number of threads (200) created for connector with address null and
> port 8080"*
>
> So my questions are:
>
>     Is this exception because of mysql connection pool? If yes, what should
> I do to solve it? My MAX-Active value is 50 and MinIdle value is 1.
>
>     If this is not the case then how can I know which functionality are
> holding threads?
>
> Note: I'm not closing ResultSet, I'm closing only Statement and Connection
> can this might be the issue.
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: [pool]

Posted by Phil Steitz <ph...@gmail.com>.
On 10/1/14 8:33 AM, Phil Steitz wrote:
> On 10/1/14 1:46 AM, Ashish Chaudhary wrote:
>> I am getting this error  *"INFO: Maximum number of threads (200) created
>> for connector with address null and port 8080"*  on prod in approximately
>> every 7-8 days. So to debug this issue I downloaded the thread dump file.
>> This file has following thread state 100 times:
>>
>> "http-8080-198" daemon prio=10 tid=0x08a62c00 nid=0x3a78 in Object.wait()
>> [0x66467000]
>>    java.lang.Thread.State: WAITING (on object monitor)
>>     at java.lang.Object.wait(Native Method)
>>     - waiting on <0x87097728> (a
>> org.apache.commons.pool.impl.GenericObjectPool$Latch)
>>     at java.lang.Object.wait(Object.java:485)
>>     at
>> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1104)
>>     - locked <0x87097728> (a
>> org.apache.commons.pool.impl.GenericObjectPool$Latch)
> What version of [pool] are you running?  I assume you are also using
> DBCP.  Which version?

From the line numbers in the stack trace, it looks like you are
using pool 1.5.4, which is what DBCP 1.4 brings in by default. 
There were some capacity leaks fixed in the versions following 1.5.4
in the 1.5.x line.  One thing you could try would be to update to
1.5.7.  That version is source and binary compatible with 1.5.4 and
will work fine with DBCP 1.3/1.4.  Alternatively, you can upgrade
both DBCP and pool to the 2.x versions; but those require higher JDK
levels (see the web pages for details).

Most likely, though, you are just running out of connections and
threads are backed up waiting for free connections.  The wait above
is a thread waiting for an instance to become available from the pool.

Phil
>> My understanding is that there is some memory leak or the connection
>> objects are not enough and because of this every call waits for new MySQL
>> connection from the pool and it just hangs there and the thread associated
>> with this MySQL call also waits. And this leads to this issue *"INFO:
>> Maximum number of threads (200) created for connector with address null and
>> port 8080"*
>>
>> So my questions are:
>>
>>     Is this exception because of mysql connection pool? If yes, what should
>> I do to solve it? My MAX-Active value is 50 and MinIdle value is 1.
> Most likely, you are just running out of connections.  You can set
> maxActive higher, but if threads are holding connections, that will
> most likely just postpone the problem.
>>     If this is not the case then how can I know which functionality are
>> holding threads?
> You mean holding connections.  If you look at the full thread dump,
> there must be some threads not waiting on the pool.  Look at what
> those threads are doing.
>
> Phil
>> Note: I'm not closing ResultSet, I'm closing only Statement and Connection
>> can this might be the issue.
>>
>



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


Re: [pool]

Posted by Phil Steitz <ph...@gmail.com>.
On 10/1/14 1:46 AM, Ashish Chaudhary wrote:
> I am getting this error  *"INFO: Maximum number of threads (200) created
> for connector with address null and port 8080"*  on prod in approximately
> every 7-8 days. So to debug this issue I downloaded the thread dump file.
> This file has following thread state 100 times:
>
> "http-8080-198" daemon prio=10 tid=0x08a62c00 nid=0x3a78 in Object.wait()
> [0x66467000]
>    java.lang.Thread.State: WAITING (on object monitor)
>     at java.lang.Object.wait(Native Method)
>     - waiting on <0x87097728> (a
> org.apache.commons.pool.impl.GenericObjectPool$Latch)
>     at java.lang.Object.wait(Object.java:485)
>     at
> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1104)
>     - locked <0x87097728> (a
> org.apache.commons.pool.impl.GenericObjectPool$Latch)

What version of [pool] are you running?  I assume you are also using
DBCP.  Which version?
>
> My understanding is that there is some memory leak or the connection
> objects are not enough and because of this every call waits for new MySQL
> connection from the pool and it just hangs there and the thread associated
> with this MySQL call also waits. And this leads to this issue *"INFO:
> Maximum number of threads (200) created for connector with address null and
> port 8080"*
>
> So my questions are:
>
>     Is this exception because of mysql connection pool? If yes, what should
> I do to solve it? My MAX-Active value is 50 and MinIdle value is 1.

Most likely, you are just running out of connections.  You can set
maxActive higher, but if threads are holding connections, that will
most likely just postpone the problem.
>
>     If this is not the case then how can I know which functionality are
> holding threads?

You mean holding connections.  If you look at the full thread dump,
there must be some threads not waiting on the pool.  Look at what
those threads are doing.

Phil
>
> Note: I'm not closing ResultSet, I'm closing only Statement and Connection
> can this might be the issue.
>



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