Repository navigation
Fix BZ 70370 - Make the JDBC 4.3 request boundary hints opt-in - #1268
Closed
arturobernalg wants to merge 1 commit into
Closed
arturobernalg wants to merge 1 commit into
arturobernalg wants to merge 1 commit into
Conversation
Since the pool sends Connection.beginRequest() and endRequest() around
each borrow, a statement cached by StatementCache could be closed
before it was used again. The behaviour of endRequest() is vendor
specific and the Microsoft SQL Server driver closes every statement
created during the request, so every other borrow was given a cached
statement the driver had already closed ("The statement is closed.").
Only send the hints when the new useRequestBoundaries attribute is
enabled, which restores the behaviour of previous releases by default,
and never for a connection whose interceptor chain includes
StatementCache, as a cached statement outlives the request it was
created in.
arturobernalg
force-pushed
the
bz70370-request-hints
branch
from
November 23, 2026 14:08
225f220 to
b9a3e9c
Compare
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70370
Since 11.0.28, 10.1.62 and 9.0.124 the pool sends
Connection.beginRequest()andendRequest()around each borrow (#677). The behaviour ofendRequest()is vendor specific, and the Microsoft SQL Server driver (mssql-jdbc 13.2.1) closes every statement created during the request. A statement parked byStatementCacheoutlives the request, so every other borrow was handed a statement the driver had already closed (The statement is closed.). HSQLDB 2.7.4 fails the same way.The hints are now sent only when the new
useRequestBoundariesattribute is enabled (defaultfalse, the behaviour before 11.0.28), and never for a connection whose interceptor chain includesStatementCache.Testing:
useRequestBoundaries="true".RequestBoundariesBaseuse a driver whoseendRequest()closes the statements of the request. TheStatementCachetest fails on main with "The object is already closed". Removing theStatementCacheguard makes the two tests that cover it fail.