You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We were tracking the number of closed connections over the lifetime of a process with MaxLifetimeClosed from DBStats after setting a max connection lifetime with SetConnMaxLifetime.
What did you expect to see?
We expected MaxLifetimeClosed to be incremented once for every connection that was closed due to SetConnMaxLifetime.
What did you see instead?
Only connections closed via the background goroutine (connectionCleaner) were counted. Connections that are closed in conn (here and here) because it determines they are expired (and currently free) were not counted.
If this is the expected behavior, then I'm happy to open a PR with a fix.
The text was updated successfully, but these errors were encountered:
colinking
changed the title
[database/sql] MaxLifetimeConnections
[database/sql] Incorrect count for DBStats.MaxLifetimeClosed
Mar 25, 2020
odeke-em
changed the title
[database/sql] Incorrect count for DBStats.MaxLifetimeClosed
database/sql: incorrect count for DBStats.MaxLifetimeClosed for connections not closed in background goroutine
Mar 25, 2020
kardianos
added
NeedsFix
The path to resolution is known, but the work has not been done.
and removed
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
labels
Mar 25, 2020
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Based on the latest
master
, yeah.What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
We were tracking the number of closed connections over the lifetime of a process with
MaxLifetimeClosed
fromDBStats
after setting a max connection lifetime withSetConnMaxLifetime
.What did you expect to see?
We expected
MaxLifetimeClosed
to be incremented once for every connection that was closed due toSetConnMaxLifetime
.What did you see instead?
Only connections closed via the background goroutine (
connectionCleaner
) were counted. Connections that are closed inconn
(here and here) because it determines they are expired (and currently free) were not counted.If this is the expected behavior, then I'm happy to open a PR with a fix.
The text was updated successfully, but these errors were encountered: