server: make HikariCP leak detection configurable#13394
Draft
andrijapanicsb wants to merge 1 commit into
Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #13394 +/- ##
============================================
- Coverage 17.68% 17.67% -0.01%
+ Complexity 15793 15788 -5
============================================
Files 5922 5922
Lines 533123 533179 +56
Branches 65201 65208 +7
============================================
- Hits 94268 94245 -23
- Misses 428212 428288 +76
- Partials 10643 10646 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
server: make HikariCP leak detection configurable
Summary
This change adds optional CloudStack management-server database settings for HikariCP leak detection and JMX MBean registration.
db.cloud.leakDetectionThresholdsupport and map it toHikariConfig#setLeakDetectionThreshold(long).db.cloud.registerMbeanssupport and map it toHikariConfig#setRegisterMbeans(boolean).client/conf/db.properties.in.Motivation
Operators debugging management-server DB pool exhaustion need a runtime-configurable way to identify code paths that borrow JDBC connections and do not return them quickly enough. HikariCP already supports leak-detection stack traces and JMX pool counters, but CloudStack did not expose those options through
db.properties.These settings make it possible to enable leak diagnostics temporarily during investigation without hard-coding a threshold or changing production defaults.
Implementation
db.cloud.leakDetectionThresholdas an optional long value alongside the existing cloud DB pool tuning properties.db.cloud.registerMbeansas an optional boolean value.0for leak detection andfalsefor MBean registration.TransactionLegacyTestcoverage for absent, disabled, enabled leak-detection, and enabled MBean settings.TransactionLegacy.CONNECTION_PARAMSsuffix.Testing
Ran the following validation:
Results:
git diff --checkpassed.TransactionLegacyTestpassed with 12 tests, 0 failures.framework/dbcompile passed.Runtime Usage
To enable leak diagnostics after deploying a package built from this branch, set the following in
/etc/cloudstack/management/db.properties:Then restart the management server:
During reproduction, inspect the management-server log for HikariCP leak-detection output:
grep -i "leak detection\|Apparent connection leak\|ProxyLeakTask\|Hikari" /var/log/cloudstack/management/management-server.logSigned-off-by: andrijapanicsb andrija.panic@gmail.com