Uh oh!
There was an error while loading. Please reload this page.
features/sql: add a leak detection threshold for the connection pool - #627
Open
cportele wants to merge 1 commit into
Open
features/sql: add a leak detection threshold for the connection pool#627cportele wants to merge 1 commit into
cportele wants to merge 1 commit into
Conversation
connectionInfo.pool.leakDetectionThreshold enables HikariCP's leak detection: a connection out of the pool for longer than the threshold is logged with the stack trace of the code that leased it, and a second message follows if it is returned after all. Off by default; the value has to be at least 2s and is checked for equality when a pool is shared.
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 freeto 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.
Adds
connectionInfo.pool.leakDetectionThresholdfor SQL feature providers, exposing HikariCP'sleak detection as a diagnostic option (off by default).
When a connection has been out of the pool for longer than the threshold, HikariCP logs a warning
with the stack trace of the code that leased it; if the connection is returned after all, a second
message follows, so a slow request can be told from a leak (a leak only ever produces the first
message). Minimum 2 s (HikariCP disables smaller values with a warning); the value is checked for
equality when a pool is shared between providers. The messages come from the logger
com.zaxxer.hikari(WARNfor the report,INFOfor the return message) — a loggingconfiguration that restricts third-party loggers has to let them through; ldproxy's default does.
This is a diagnostic, not a remedy: a leaked connection stays leaked until restart, and long-running
requests (large exports, big transactions) legitimately hold a connection, so the value should sit
above the longest expected request. Motivated by ldproxy/ldproxy#1761, where the borrower's stack
trace would have pinpointed the leaking path directly.