You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sai Kumar <sa...@gmail.com> on 2017/07/10 07:20:50 UTC

Solution for the connection pool issue

Hi Users,

im getting the connection pool issue.


*Unable to fetch a connection in xx seconds, none available[size:xxx;
busy:xxx; idle:xx; lastwait:xxxx]. *

*And Idle count is incresing more than the Maxidle connections.*




*Here is the server.xml configured file,*
>
> <Resource name="@scc.datasource.name@" auth="Container"
> factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>                         type="javax.sql.DataSource" maxActive="100"
> minIdle="10" maxIdle="30"
>                         maxWait="10000" username="@scc.datasource.username@"
> password="@scc.datasource.password@"
>                         driverClassName="@scc.datasource.driver@"
> url="@scc.datasource.driverurl@" logAbandoned="true"
>                         validationQuery="SELECT 1"
>                           removeAbandoned="true"
>                           testOnBorrow="true"
>                           testWhileIdle="true"
>                           timeBetweenEvictionRunsMillis="10000"
>                           minEvictableIdleTimeMillis="180000"
>                           removeAbandonedTimeout="60"
>                     />
>                     <Resource name="@scc.reports.datasource.name@"
> auth="Container" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>                         type="javax.sql.DataSource" maxActive="100"
> minIdle="10" maxIdle="30"
>                         maxWait="10000"
> username="@scc.reports.datasource.username@"
> password="@scc.reports.datasource.password@"
>                         driverClassName="@scc.reports.datasource.driver@"
> url="@scc.reports.datasource.driverurl@" logAbandoned="true"
>                         validationQuery="SELECT 1"
>                           removeAbandoned="true"
>                           testOnBorrow="true"
>                           testWhileIdle="true"
>                           timeBetweenEvictionRunsMillis="10000"
>                           minEvictableIdleTimeMillis="180000"
>                           removeAbandonedTimeout="60"
>                       />
>                     <Resource name="@scc.tickets.datasource.name@"
> auth="Container" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>                         type="javax.sql.DataSource" maxActive="100"
> minIdle="10"  maxIdle="30"
>                         maxWait="10000"
> username="@scc.tickets.datasource.username@"
> password="@scc.tickets.datasource.password@"
>                         driverClassName="@scc.tickets.datasource.driver@"
> url="@scc.tickets.datasource.driverurl@"
>                         validationQuery="SELECT 1"
>                           removeAbandoned="true"
>                           testOnBorrow="true"
>                           testWhileIdle="true"
>                           timeBetweenEvictionRunsMillis="10000"
>                           minEvictableIdleTimeMillis="180000"
>                           removeAbandonedTimeout="60"
>                       />
>                       <Resource name="@monitoring.datasource.name@"
> auth="Container" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>                         type="javax.sql.DataSource" maxActive="100"
> minIdle="10" maxIdle="30"
>                         maxWait="10000"
> username="@monitoring.datasource.username@"
> password="@monitoring.datasource.password@"
>                         driverClassName="@monitoring.datasource.driver@"
> url="@monitoring.datasource.driverurl@"
>                         validationQuery="SELECT 1"
>                           removeAbandoned="true"
>                           testOnBorrow="true"
>                           testWhileIdle="true"
>                           timeBetweenEvictionRunsMillis="10000"
>                           minEvictableIdleTimeMillis="180000"
>                           removeAbandonedTimeout="60"
>                       />
>


I checked my code,There is no problem with closing connections and all.


I was tried with upgrading tomcat from 7.0.52 to minor versions of 7.0.x
and Major version 8.0.x too.

Please tell me the solution permanent solution for this.


-- 
S Saikumar

Re: Solution for the connection pool issue

Posted by Mark Thomas <ma...@apache.org>.
On 10/07/17 08:20, Sai Kumar wrote:
> Hi Users,
> 
> im getting the connection pool issue.
> 
> 
> *Unable to fetch a connection in xx seconds, none available[size:xxx;
> busy:xxx; idle:xx; lastwait:xxxx]. *

It would have been helpful if you had not replaced those values with xxx.

> *And Idle count is incresing more than the Maxidle connections.*
> 
> 
> 
> 
> *Here is the server.xml configured file,*
>>
>> <Resource name="@scc.datasource.name@" auth="Container"
>> factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>>                         type="javax.sql.DataSource" maxActive="100"
>> minIdle="10" maxIdle="30"
>>                         maxWait="10000" username="@scc.datasource.username@"
>> password="@scc.datasource.password@"
>>                         driverClassName="@scc.datasource.driver@"
>> url="@scc.datasource.driverurl@" logAbandoned="true"
>>                         validationQuery="SELECT 1"
>>                           removeAbandoned="true"
>>                           testOnBorrow="true"
>>                           testWhileIdle="true"
>>                           timeBetweenEvictionRunsMillis="10000"
>>                           minEvictableIdleTimeMillis="180000"
>>                           removeAbandonedTimeout="60"
>>                     />
>>                     <Resource name="@scc.reports.datasource.name@"
>> auth="Container" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>>                         type="javax.sql.DataSource" maxActive="100"
>> minIdle="10" maxIdle="30"
>>                         maxWait="10000"
>> username="@scc.reports.datasource.username@"
>> password="@scc.reports.datasource.password@"
>>                         driverClassName="@scc.reports.datasource.driver@"
>> url="@scc.reports.datasource.driverurl@" logAbandoned="true"
>>                         validationQuery="SELECT 1"
>>                           removeAbandoned="true"
>>                           testOnBorrow="true"
>>                           testWhileIdle="true"
>>                           timeBetweenEvictionRunsMillis="10000"
>>                           minEvictableIdleTimeMillis="180000"
>>                           removeAbandonedTimeout="60"
>>                       />
>>                     <Resource name="@scc.tickets.datasource.name@"
>> auth="Container" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>>                         type="javax.sql.DataSource" maxActive="100"
>> minIdle="10"  maxIdle="30"
>>                         maxWait="10000"
>> username="@scc.tickets.datasource.username@"
>> password="@scc.tickets.datasource.password@"
>>                         driverClassName="@scc.tickets.datasource.driver@"
>> url="@scc.tickets.datasource.driverurl@"
>>                         validationQuery="SELECT 1"
>>                           removeAbandoned="true"
>>                           testOnBorrow="true"
>>                           testWhileIdle="true"
>>                           timeBetweenEvictionRunsMillis="10000"
>>                           minEvictableIdleTimeMillis="180000"
>>                           removeAbandonedTimeout="60"
>>                       />
>>                       <Resource name="@monitoring.datasource.name@"
>> auth="Container" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>>                         type="javax.sql.DataSource" maxActive="100"
>> minIdle="10" maxIdle="30"
>>                         maxWait="10000"
>> username="@monitoring.datasource.username@"
>> password="@monitoring.datasource.password@"
>>                         driverClassName="@monitoring.datasource.driver@"
>> url="@monitoring.datasource.driverurl@"
>>                         validationQuery="SELECT 1"
>>                           removeAbandoned="true"
>>                           testOnBorrow="true"
>>                           testWhileIdle="true"
>>                           timeBetweenEvictionRunsMillis="10000"
>>                           minEvictableIdleTimeMillis="180000"
>>                           removeAbandonedTimeout="60"
>>                       />
>>
> 
> 
> I checked my code,There is no problem with closing connections and all.
> 
> 
> I was tried with upgrading tomcat from 7.0.52 to minor versions of 7.0.x
> and Major version 8.0.x too.
> 
> Please tell me the solution permanent solution for this.

Absent a test case that demonstrates the problem it is pretty much
impossible for us to diagnose the problem based on the information
provided here.

Possible ways forward include:
- Take a series of 3 thread dumps 10s apart when the problem occurs.
  Analyse the thread dump for hints to what is going on.
- Configure the Tomcat for remote debugging, set a break point for
  connection borrow and step through the code using your favourite IDE
  when it stops working.
- Take a look at state of the pool(s) via JMX when the problem occurs.

The more relevant information you provide, the more likely we are to be
able to help.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Solution for the connection pool issue

Posted by Guang Chao <gu...@gmail.com>.
On Mon, Jul 10, 2017 at 3:20 PM, Sai Kumar <sa...@gmail.com>
wrote:

> Hi Users,
>
> im getting the connection pool issue.
>
>
> *Unable to fetch a connection in xx seconds, none available[size:xxx;
> busy:xxx; idle:xx; lastwait:xxxx]. *
>
> *And Idle count is incresing more than the Maxidle connections.*
>
>
>
>
> *Here is the server.xml configured file,*
> >
> > <Resource name="@scc.datasource.name@" auth="Container"
> > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
> >                         type="javax.sql.DataSource" maxActive="100"
> > minIdle="10" maxIdle="30"
> >                         maxWait="10000" username="@scc.datasource.
> username@"
> > password="@scc.datasource.password@"
> >                         driverClassName="@scc.datasource.driver@"
> > url="@scc.datasource.driverurl@" logAbandoned="true"
> >                         validationQuery="SELECT 1"
> >                           removeAbandoned="true"
> >                           testOnBorrow="true"
> >                           testWhileIdle="true"
> >                           timeBetweenEvictionRunsMillis="10000"
> >                           minEvictableIdleTimeMillis="180000"
> >                           removeAbandonedTimeout="60"
> >                     />
> >                     <Resource name="@scc.reports.datasource.name@"
> > auth="Container" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
> >                         type="javax.sql.DataSource" maxActive="100"
> > minIdle="10" maxIdle="30"
> >                         maxWait="10000"
> > username="@scc.reports.datasource.username@"
> > password="@scc.reports.datasource.password@"
> >                         driverClassName="@scc.reports.datasource.driver@
> "
> > url="@scc.reports.datasource.driverurl@" logAbandoned="true"
> >                         validationQuery="SELECT 1"
> >                           removeAbandoned="true"
> >                           testOnBorrow="true"
> >                           testWhileIdle="true"
> >                           timeBetweenEvictionRunsMillis="10000"
> >                           minEvictableIdleTimeMillis="180000"
> >                           removeAbandonedTimeout="60"
> >                       />
> >                     <Resource name="@scc.tickets.datasource.name@"
> > auth="Container" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
> >                         type="javax.sql.DataSource" maxActive="100"
> > minIdle="10"  maxIdle="30"
> >                         maxWait="10000"
> > username="@scc.tickets.datasource.username@"
> > password="@scc.tickets.datasource.password@"
> >                         driverClassName="@scc.tickets.datasource.driver@
> "
> > url="@scc.tickets.datasource.driverurl@"
> >                         validationQuery="SELECT 1"
> >                           removeAbandoned="true"
> >                           testOnBorrow="true"
> >                           testWhileIdle="true"
> >                           timeBetweenEvictionRunsMillis="10000"
> >                           minEvictableIdleTimeMillis="180000"
> >                           removeAbandonedTimeout="60"
> >                       />
> >                       <Resource name="@monitoring.datasource.name@"
> > auth="Container" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
> >                         type="javax.sql.DataSource" maxActive="100"
> > minIdle="10" maxIdle="30"
> >                         maxWait="10000"
> > username="@monitoring.datasource.username@"
> > password="@monitoring.datasource.password@"
> >                         driverClassName="@monitoring.datasource.driver@"
> > url="@monitoring.datasource.driverurl@"
> >                         validationQuery="SELECT 1"
> >                           removeAbandoned="true"
> >                           testOnBorrow="true"
> >                           testWhileIdle="true"
> >                           timeBetweenEvictionRunsMillis="10000"
> >                           minEvictableIdleTimeMillis="180000"
> >                           removeAbandonedTimeout="60"
> >                       />
> >
>
>
> I checked my code,There is no problem with closing connections and all.
>
>
Can you share your code that looks up for connection?


>
> I was tried with upgrading tomcat from 7.0.52 to minor versions of 7.0.x
> and Major version 8.0.x too.
>
> Please tell me the solution permanent solution for this.
>
>
> --
> S Saikumar
>



-- 
Guang <http://javadevnotes.com/java-double-to-int/>