Tim,

> -----Original Message-----
> From: Scott,Tim <tim.sc...@oclc.org>
> Sent: Friday, August 25, 2023 3:09 AM
> To: users@tomcat.apache.org
> Subject: DataSource Connection pool leak
> 
> Hi,
> 
> For various diagnostics, I tried Tomcat 9.0.79 recently on a development
> machine. It didn't solve the problem I was experiencing - that was later
> identified as a problem in IntelliJ with remote deployment and is not why I'm
> mailing.
> 
> I tweaked my Tomcat 9.0.79 configuration to start my application manually, as
> IntelliJ refused to deploy remotely.
> 
> This lead to it quickly exhausting its connection pool and then hanging*
> before the application could complete its startup activity.
>                 * Each request for a connection from the pool timed out. The 
> log
> shows that all 20 connections were allocated.
> 
> I pointed my system back to 9.0.68, and it started up fine.
> 
> I tried all versions I could find back from 9.0.78 through 9.0.71 - and ran 
> into
> the same connection pool problem as 9.0.79 with every version.
> 
> v9.0.70 worked.
>                 (well, at least didn't exhibit the same problem - the 
> application
> completed its startup activity and was operational).
> 
> I would therefore conclude that something about the way I'm managing my
> database connection pool is preventing 9.0.71 onward from freeing up the
> connections.
> 
> My application uses javax.sql.DataSource with Corretto JDK 11 (11.0.16+8-
> LTS, to be specific).
> 
> It struck me as odd as that means that all releases in the last 8 months have
> this problem for my application. Has anyone else, here, run into a similar
> problem?
> 
> If a pool size of 20 is just too low, I think I'd need to set mine to a few
> hundred to complete the application startup and I'm not willing to try that
> without further insight.
> 
> Thanks,
> Tim
> 
> --
> Tim Scott (he/him/his)
> OCLC * Lead Software Engineer / Technical Product Manager
> 
> 
> cc: IT file

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.

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:

https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html

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.

Also, you can take thread dumps to see what your threads are doing.  If they 
are actually using the connection, you might see a query in flight.  Then you 
can ask yourself why they're taking so long.

John



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

Reply via email to