Repository navigation
fix(pool): release prepared statements after reset failures - #6744
Open
wozhenbang2004 wants to merge 2 commits into
Open
wozhenbang2004 wants to merge 2 commits into
wozhenbang2004 wants to merge 2 commits into
Conversation
|
|
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.
Fixes #6743.
When a pooled prepared statement throws from
clearParameters()orclearBatch(), exception handling currently throws before the statement is closed or returned to the cache. Returning the connection retries the same failing cleanup and then drops its trace, leaving the raw statement open until the physical connection closes.Release the wrapper and its result sets before reporting the original reset exception. Close new statements directly and evict cached statements through the existing pool path. Remember reset failure on the shared holder so another wrapper cannot put it back into the cache; defer its physical close until the last reference is released. Preserve a secondary direct-close exception as suppressed and report it to the exception sorter so a fatal close failure can still discard the connection.
Add 11 regressions for both reset methods, new and cached statements, shared holders, same-SQL replacement, duplicate close, result-set cleanup, and reset/close exception handling.
Validation
Base:
fa8dc9912637a2f729eef9f55356621fec18d40e(master).javac --release 8. Other production classes came from the official Druid 1.2.28 artifact; this is a focused source-overlay test, not a full reactor build.200/0; patched were200/200. Error count decreased from 400 to 200 because connection return no longer retries the failed wrapper.src/checkstyle/druid-checks.xml: all three changed files passed.Scope notes
Existing cache accounting for already-evicted holders and fatal shared-connection disposal needs a separate follow-up. Cache eviction retains its existing best-effort raw-close behavior; strict recovery from a non-fatal driver close failure is also outside this patch. The fatal-close regression above covers the direct-close path.