Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003837 [Resin] minor always 01-05-10 15:00 01-07-10 10:00
Reporter alex View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.1.9
Summary 0003837: DBPool does not wait for connections according to logic specified by <connection-wait-time>
Description I created a
simple WAR that you can drop into any resin instance to see what I'm seeing.
I'll also include a link to my production server where you can see it
running.

 I wrote a JSP page that launches a several threads, grabs connections from
the DataSource, sleeps, then returns the connection to the pool.

I have a datasource configured in resin.conf as follows:

   <database>
     <jndi-name>conTest</jndi-name>
     <driver type="com.mysql.jdbc.Driver">
       <url>jdbc:mysql://xxx</url> [^]
       <user>x</user>
       <password>xxx</password>
     </driver>
     <prepared-statement-cache-size>0</prepared-statement-cache-size>
     <max-connections>10</max-connections>
     <connection-wait-time>10s</connection-wait-time>
     <max-overflow-connections>0</max-overflow-connections>
     <max-idle-time>15s</max-idle-time>
   </database>

A url such as the following hit's this WAR on my production box

https://76.12.177.66:9080/con-war-1.0/conBlock.jsp?threads=20&sleep=2000 [^]

So it's creating 20 threads, with a sleep time of 2s of holding onto the
connections.

The first time you hit this page you'll notice you get exceptions that the
some of the threads were unable to retrieve connections (pool was full).
But it shouldn't be. Those threads did not wait 10s. Although they do
appear to wait roughly 2s, which means just about the time the connections
where available they are returning the pool is full.

If you reload the page you'll notice it works. That is, all 20 threads get
a connection the entire page load takes about 4s.

If you wait 15s for the pool to release idle connections, then reload the
page, the errors will reappear.

So the issue appears to be that the pool is mistakenly throwing a Pool is
full exception when the pool is growing or it's trying to grow. Once the
pool is full it seems to function as advertised.
Additional Information
Attached Files  con-war-1.0.war [^] (11,425 bytes) 01-05-10 15:00

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
01-05-10 15:00 alex New Issue
01-05-10 15:00 alex File Added: con-war-1.0.war
01-07-10 10:00 ferg Assigned To  => ferg
01-07-10 10:00 ferg Status new => closed
01-07-10 10:00 ferg Resolution open => fixed
01-07-10 10:00 ferg Fixed in Version  => 3.1.10


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker