Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spanner: Track stacktrace of sessionPool.take()
Sessions are automatically checked out of the session pool by the client library when one is needed, and returned to the pool when the user closes the transaction and/or row iterator that was used. If the user however forgets to close the transaction or row iterator, the session will leak and the user will eventually get an error while trying to start a transaction. This error can occur in a completely unrelated part of the application than the part that causes the session leak, which makes these bugs very hard to debug and track down. This change allows the user to instruct the session pool to keep track of the stacktrace of each goroutine that checks out a session from the pool. The stacktraces of all checked out sessions + the time the session was taken from the pool is then included in the error that is returned when the session pool has been exhausted and no more sessions can be returned. This option can be used to track down the part(s) of the application that is causing a session leak. This feature is disabled by default, and must be enabled specifically by a user to have any effect. Updates #1616. Change-Id: I2ba84b65f391a99d0bed364d2a8e94f7467e3704 Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/47150 Reviewed-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Cody Oss <codyoss@google.com> Reviewed-by: Tyler Bui-Palsulich <tbp@google.com>
- Loading branch information
Showing
3 changed files
with
204 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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