]> Cypherpunks repositories - gostls13.git/commit
database/sql: do not leak the connectionResetter goroutine
authorDaniel Theophanes <kardianos@gmail.com>
Mon, 13 Nov 2017 22:25:19 +0000 (14:25 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 14 Nov 2017 00:25:42 +0000 (00:25 +0000)
commitf7df55d174b886f8aea0243aa40e8debffbdffc0
tree1771ad97eb45330e0dbf974a48104f56270dfcc4
parent4aea3e7135a1945dc183e3c0d9180cbed2ed6ba7
database/sql: do not leak the connectionResetter goroutine

Before terminating the connectionResetter goroutine the connection
pool processes all of the connections on the channel to unlock the
driverConn instances so everthing can shutdown cleanly. However
the channel was never closed so the goroutine hangs on the range.
Close the channel prior to ranging over it. Also prevent additional
connections from being sent to the resetter after the connection
pool has been closed.

Fixes #22699

Change-Id: I440d2b13cbedec2e04621557f5bd0b1526933dd7
Reviewed-on: https://go-review.googlesource.com/77390
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/database/sql/sql.go