Hello,

I have the problem that the Tomcat connection pool uses more than the maxActive 
connections. In my Dropwizard application I have configured a maxSize of 30, 
but I found the following message in the logs.

Timeout: Pool empty. Unable to fetch a connection in 15 seconds, none 
available[size:31; busy:31; idle:0; lastwait:15000]

This seems to be related to a high pressure on the DB. In the DB logs I also 
found some connection issues
The code in the PooledConnection class does not seem to be completely 
bulletproof, because there can't be only two threads that have gone through the 
first if-two, or am I wrong?

//if we get here, see if we need to create one
//this is not 100% accurate since it doesn't use a shared
//atomic variable - a connection can become idle while we are creating
//a new connection
if (size.get() < getPoolProperties().getMaxActive()) {
    //atomic duplicate check
    if (size.addAndGet(1) > getPoolProperties().getMaxActive()) {
        //if we got here, two threads passed through the first if
        size.decrementAndGet();
    } else {
        //create a connection, we're below the limit
        return createConnection(now, con, username, password);
    }
} //end if

In the end, this problem causes all my available DB connections to be used up 
and my application to fail.
Is this a known problem? Is there a workaround?

Thanks for your answers,
Regards Stefan


Stefan López Romero
Senior Lead IT Architect

Theresienhöhe 13, 80339 München
stefan.lo...@maibornwolff.de
+49 151 544 22 050


[cid:image149c85.PNG@ee2dc33c.41920058]<https://www.maibornwolff.de/>

MaibornWolff GmbH
Theresienhöhe 13, 80339 München
www.maibornwolff.de
Telefon +49 89 544 253 000
USt-ID DE 129 299 525
Amtsgericht München HRB 98058
Geschäftsführer: Volker Maiborn,
Holger Wolff, Alexander Hofmann, Florian Theimer,
Marcus Adlwart, Dr. Martina Beck, Christian Loos

______________________________________________


Reply via email to