> On 2025 Aug 16, at 00:02, Robert Turner <rtur...@e-djuster.ca.INVALID> wrote:
> 
> Dan,
> 
> What's your thread pool size?
> 
> With the default of 5, I can never get the high watermark for the
> connection above 5 (as I would expect). If I bump up the thread pool max
> size, and decrease the maximum db connection pool size, I can then get
> connections to queue, etc.
> 
> They behave exactly as I would expect and I can never trigger a message
> about being unable to obtain a connection.
> 
> I added a sleep of 200ms in the previous code I shared while holding the
> connection to simulate being slow.
> 
> Everything worked without issue. I can fire thousands of connections at it
> with no running out of connection problems. Requests queue up and wait for
> a connection to be released.
> 
> There must be something wrong with how you are managing and using the
> connections.
> 
> Could you provide a sample of the code that uses the connection?


Seeing the exact configuration of the JDBC pool would also be useful, but a 
quick perusal of the GlassFish asadmin doc didn’t come up with a way to display 
that.

Also, here’s an interesting config item that might be useful in tracking down 
problems:


--wrapjdbcobjects
Specifies whether the pooling infrastructure provides wrapped JDBC objects to 
applications. By providing wrapped JDBC objects, the pooling infrastructure 
prevents connection leaks by ensuring that applications use logical connections 
from the connection pool, not physical connections. The use of logical 
connections ensures that the connections are returned to the connection pool 
when they are closed. However, the provision of wrapped JDBC objects can impair 
the performance of applications. The default value is true.
The pooling infrastructure provides wrapped objects for implementations of the 
following interfaces in the JDBC API:

java.sql.CallableStatement

java.sql.DatabaseMetaData

java.sql.PreparedStatement

java.sql.ResultSet

java.sql.Statement

Possible values of --wrapjdbcobjects are as follows:

false
The pooling infrastructure does not provide wrapped JDBC objects to 
applications. (default).

true
The pooling infrastructure provides wrapped JDBC objects to applications.


Not sure what the default setting actually is, since the general description 
says it’s true, but the specific description of false says that’s the default. 
(The GlassFish doc leaves a bit to be desired…)

Explicitly setting wrap-jdbc-objects to true should take care of non-connection 
resource leaks, and I suspect performance isn’t a serious concern at this stage.

  - Chuck


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

Reply via email to