Defer abandoned connection trace formatting - #1048
Open
sainadh777 wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
Hi @markt-asf, when you have time, would you be willing to review this JDBC-pool change? I selected you because you are a leading recent contributor to these paths and were the requested reviewer on the closest merged JDBC-pool PR. Thank you. |
sainadh777
marked this pull request as ready for review
August 19, 2026 04:41
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.
Summary
Complete maintained
TODO.mditem 39.1 by retaining abandoned-connection stack frames and formatting them only when the trace is actually read.Rationale and impact
When
logAbandonedis enabled, each connection borrow currently captures and immediately formats an exception stack trace into aString. Most of those traces are replaced by a later borrow without ever being reported.This change stores the captured
StackTraceElement[]inPooledConnectionand performs the existing string formatting lazily ingetStackTrace(). The public String-based accessor methods remain compatible, and the text returned for a reported abandoned connection is unchanged. The regression test verifies both deferred formatting and the eventual trace contents.Validation
All commands used JDK 25.
ant -f modules/jdbc-pool/build.xml onetest -Dtest=AbandonedTraceTest -Dtomcat.xsl.loc=file:/private/tmp/tomcat-weekly.cfR2QA/webapps/docs/tomcat-docs.xsl -Dtomcat.project.loc=file:/private/tmp/tomcat-weekly.cfR2QA/modules/jdbc-pool/doc/project.xml— passed: 1 test, 0 failures, 0 errors, 0 skipped.ant -f modules/jdbc-pool/build.xml test -Dtomcat.xsl.loc=file:/private/tmp/tomcat-weekly.cfR2QA/webapps/docs/tomcat-docs.xsl -Dtomcat.project.loc=file:/private/tmp/tomcat-weekly.cfR2QA/modules/jdbc-pool/doc/project.xml— passed: all JDBC-pool functional, fairness, performance, and validation suites; 0 failures and 0 errors.ant validate -Dexecute.validate=true— passed Checkstyle over 7,690 files.ant clean deploy— passed clean source/distribution build.ant clean testin an isolated Ubuntu 24.04 arm64 container (eclipse-temurin:25-jdk-noble, Ant 1.10.14, host networking) — passed the complete unfiltered suite in 31m38s: 41,264 tests, 0 failures, 0 errors, 315 skipped across 650 reports.output/build/bin/startup.sh;curl http://127.0.0.1:8080/;output/build/bin/shutdown.shin the same Linux container — HTTP 200 received and the generated Tomcat process stopped cleanly.For completeness, an initial unfiltered
ant teston macOS was not used as the release gate because it hit platform-specific multicast routing failures, LibreSSL cipher mismatches, and pathological timing. The identical source snapshot subsequently passed the complete Linux run above.