You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nathan Christiansen <Na...@tni.com> on 2003/09/17 19:20:09 UTC

MySQL DBCP pool exausted error message

When I stress test my web app using JMeter, I am suddenly getting a "DBCP could not obtain an idle db connection, pool exhausted" SQLException thrown.

When I test with 25 simulated users every one of my 25 threads gets the exception after the first 25 requests.

What am I doing wrong?

My setup:

RH Linux 7.1
Java 1.4.1_01
Tomcat 4.1.24
DBCP 1.0

MySQL 3.23.56


My pertinent DBCP configuration:

removeAbandoned = true
maxActive = 25
maxIdle = 10
maxWait = 10000
url ends with ?autoReconnect=true

I double checked that all of my database connections in my code follow the pattern of:

Connection conDBConnection = getConnection();
PreparedStatement psDBStatement = null;
ResultSet rsDBResult = null;
  
try
{
  psDBStatement = conDBConnection.prepareStatement("select query from views where viewid = ?");
  psDBStatement.setInt(1, nViewID);
  rsDBResult = psDBStatement.executeQuery();
      
  if (rsDBResult.next())
  {
    strReturnValue = rsDBResult.getString(1);
  }
}
catch (SQLException sqle)
{
  sqle.printStackTrace();
  strReturnValue = null;
}
finally
{
  try
  {
    if (rsDBResult != null) rsDBResult.close();
    if (psDBStatement != null) psDBStatement.close();
    if (conDBConnection != null) conDBConnection.close();
  }
  catch (SQLException sqle)
  {
    sqle.printStackTrace();
  }
}




-- Nathan Christiansen
   Tahitian Noni International
   http://www.tahitiannoni.com

Re: 365 logfiles a year

Posted by Tim Funk <fu...@joedog.org>.
The access logs are configureable to turn this off but the other Loggers are not.

See the javadocs for AccessLogValve on how to turn it off.

-Tim

P.van Kemenade wrote:
> Hi
> 
> http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/logger.html says
> " The actual filenames of the  log files are created from a configured 
> prefix,
> the current date in  YYYY-MM-DD format, and a configured suffix. "
> 
> nice feature ... (hm) .. can I also turn that off ?
> 1 logfile is enough. logrotate will manage it.


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


Re: 365 logfiles a year

Posted by Tim Funk <fu...@joedog.org>.
The access logs are configureable to turn this off but the other Loggers are not.

See the javadocs for AccessLogValve on how to turn it off.

-Tim

P.van Kemenade wrote:
> Hi
> 
> http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/logger.html says
> " The actual filenames of the  log files are created from a configured 
> prefix,
> the current date in  YYYY-MM-DD format, and a configured suffix. "
> 
> nice feature ... (hm) .. can I also turn that off ?
> 1 logfile is enough. logrotate will manage it.


365 logfiles a year

Posted by "P.van Kemenade" <pi...@kw.nl>.
Hi

http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/logger.html says
" The actual filenames of the  log files are created from a configured 
prefix,
the current date in  YYYY-MM-DD format, and a configured suffix. "

nice feature ... (hm) .. can I also turn that off ?
1 logfile is enough. logrotate will manage it.

thanks,
*-pike
============

Internet search engines that take money from Web sites in exchange for 
prominent placement should make that practice clearer to Web users, 
federal regulators said Friday.Many search engine Web sites, including 
AltaVista, LookSmart and AOL Search, give preferred placement to paid 
advertisers. The Federal Trade Commission said that prime space can 
confuse Web users who are looking for the best response to their 
search, rather than ads for sites that paid up front.


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


365 logfiles a year

Posted by "P.van Kemenade" <pi...@kw.nl>.
Hi

http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/logger.html says
" The actual filenames of the  log files are created from a configured 
prefix,
the current date in  YYYY-MM-DD format, and a configured suffix. "

nice feature ... (hm) .. can I also turn that off ?
1 logfile is enough. logrotate will manage it.

thanks,
*-pike
============

Internet search engines that take money from Web sites in exchange for 
prominent placement should make that practice clearer to Web users, 
federal regulators said Friday.Many search engine Web sites, including 
AltaVista, LookSmart and AOL Search, give preferred placement to paid 
advertisers. The Federal Trade Commission said that prime space can 
confuse Web users who are looking for the best response to their 
search, rather than ads for sites that paid up front.


Re: MySQL DBCP pool exausted error message

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Hi Nathan,

could you rephrase what the problem is? It's a bit ambiguous. Do you 
mean that each thread can only do one DB operation and then it gets the 
exception on its next DB operation, or on its next http request?

Have you checked in bugzilla? I think there are some unresolved issues 
with DBCP. (I keep meaning to do that myself.) Not sure what issues though.

Also, are you sure that is the only exception you are getting? Could it 
be that your error handling is not closing the connections when an 
exception originally appears?


Adam


On 09/17/2003 07:20 PM Nathan Christiansen wrote:
> When I stress test my web app using JMeter, I am suddenly getting a "DBCP could not obtain an idle db connection, pool exhausted" SQLException thrown.
> 
> When I test with 25 simulated users every one of my 25 threads gets the exception after the first 25 requests.
> 
> What am I doing wrong?
> 
> My setup:
> 
> RH Linux 7.1
> Java 1.4.1_01
> Tomcat 4.1.24
> DBCP 1.0
> 
> MySQL 3.23.56
> 
> 
> My pertinent DBCP configuration:
> 
> removeAbandoned = true
> maxActive = 25
> maxIdle = 10
> maxWait = 10000
> url ends with ?autoReconnect=true
> 
> I double checked that all of my database connections in my code follow the pattern of:
> 
> Connection conDBConnection = getConnection();
> PreparedStatement psDBStatement = null;
> ResultSet rsDBResult = null;
>   
> try
> {
>   psDBStatement = conDBConnection.prepareStatement("select query from views where viewid = ?");
>   psDBStatement.setInt(1, nViewID);
>   rsDBResult = psDBStatement.executeQuery();
>       
>   if (rsDBResult.next())
>   {
>     strReturnValue = rsDBResult.getString(1);
>   }
> }
> catch (SQLException sqle)
> {
>   sqle.printStackTrace();
>   strReturnValue = null;
> }
> finally
> {
>   try
>   {
>     if (rsDBResult != null) rsDBResult.close();
>     if (psDBStatement != null) psDBStatement.close();
>     if (conDBConnection != null) conDBConnection.close();
>   }
>   catch (SQLException sqle)
>   {
>     sqle.printStackTrace();
>   }
> }
> 
> 
> 
> 
> -- Nathan Christiansen
>    Tahitian Noni International
>    http://www.tahitiannoni.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

-- 
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9


Re: MySQL DBCP pool exausted error message

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Hi Nathan,

could you rephrase what the problem is? It's a bit ambiguous. Do you 
mean that each thread can only do one DB operation and then it gets the 
exception on its next DB operation, or on its next http request?

Have you checked in bugzilla? I think there are some unresolved issues 
with DBCP. (I keep meaning to do that myself.) Not sure what issues though.

Also, are you sure that is the only exception you are getting? Could it 
be that your error handling is not closing the connections when an 
exception originally appears?


Adam


On 09/17/2003 07:20 PM Nathan Christiansen wrote:
> When I stress test my web app using JMeter, I am suddenly getting a "DBCP could not obtain an idle db connection, pool exhausted" SQLException thrown.
> 
> When I test with 25 simulated users every one of my 25 threads gets the exception after the first 25 requests.
> 
> What am I doing wrong?
> 
> My setup:
> 
> RH Linux 7.1
> Java 1.4.1_01
> Tomcat 4.1.24
> DBCP 1.0
> 
> MySQL 3.23.56
> 
> 
> My pertinent DBCP configuration:
> 
> removeAbandoned = true
> maxActive = 25
> maxIdle = 10
> maxWait = 10000
> url ends with ?autoReconnect=true
> 
> I double checked that all of my database connections in my code follow the pattern of:
> 
> Connection conDBConnection = getConnection();
> PreparedStatement psDBStatement = null;
> ResultSet rsDBResult = null;
>   
> try
> {
>   psDBStatement = conDBConnection.prepareStatement("select query from views where viewid = ?");
>   psDBStatement.setInt(1, nViewID);
>   rsDBResult = psDBStatement.executeQuery();
>       
>   if (rsDBResult.next())
>   {
>     strReturnValue = rsDBResult.getString(1);
>   }
> }
> catch (SQLException sqle)
> {
>   sqle.printStackTrace();
>   strReturnValue = null;
> }
> finally
> {
>   try
>   {
>     if (rsDBResult != null) rsDBResult.close();
>     if (psDBStatement != null) psDBStatement.close();
>     if (conDBConnection != null) conDBConnection.close();
>   }
>   catch (SQLException sqle)
>   {
>     sqle.printStackTrace();
>   }
> }
> 
> 
> 
> 
> -- Nathan Christiansen
>    Tahitian Noni International
>    http://www.tahitiannoni.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

-- 
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9


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