Tim,

On 8/25/23 10:48, Scott,Tim wrote:
Hi John,

Why does your app need 20 connections just to start up?  That's a
bit of a rhetorical question, but needing so many connections to
start up seems odd to me.
It doesn't. It only needs 1-2 at a time, but it makes 100s of queries
in loops, each time using a connection from the pool and passing it
back.

Yeah, this is what makes it a suspected leak, eh?

Are you using the Tomcat pool or another one?  If it's Tomcat, I
think you should use some of the abandoned connection settings
described here:
There're a few wrappers around the org.apache.commons.dbcp classes. I
have abandoned connection settings in place. The code - in fact, the
build - remains completely unchanged throughout my testing of 9.0.68,
9.0.70 - 9.0.79 as it used the same .war file. Whilst that doesn't
eliminate my code from the equation, it looks like a problem outside
my code. I will happily revise that view if nobody else has run into
a similar problem in the last 8 months - or if they have and found a
cause outside Tomcat.

I don't use 9.x but I haven't noticed a problem in 8.5.x and they are
very similar if not identical when it comes to the pooling code.

If your app is reserving connections and not releasing them, they
will be considered abandoned.  With logAbandoned=true, you'll get a
stack trace showing where the connection was obtained.
With 9.0.68 and 9.0.70 (indeed with most Tomcat versions I've used
since 8.0... ) we have worked hard to ensure that it does release
connections back to the pool appropriately. These connections are not
"abandoned" - a release was attempted.

Sometimes the "abandoned" configuration is not quite correct. Can you
post your <Resource> configuration for your application? Remove secrets
of course.

-chris

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

Reply via email to