From 23c5fffd06bcde408db50a981c015921cd4ecf0e Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Wed, 12 Jun 2024 13:19:15 +0300 Subject: [PATCH] fix(spanner): fix data-race caused by TrackSessionHandle (#10321) Fixes #10320 Co-authored-by: Sri Harsha CH <57220027+harshachinta@users.noreply.github.com> --- spanner/session.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spanner/session.go b/spanner/session.go index 76d611fe262d..b6b8996790fc 100644 --- a/spanner/session.go +++ b/spanner/session.go @@ -926,10 +926,10 @@ func (p *sessionPool) newSessionHandle(s *session) (sh *sessionHandle) { if p.TrackSessionHandles || p.ActionOnInactiveTransaction == Warn || p.ActionOnInactiveTransaction == WarnAndClose || p.ActionOnInactiveTransaction == Close { p.mu.Lock() sh.trackedSessionHandle = p.trackedSessionHandles.PushBack(sh) - p.mu.Unlock() if p.TrackSessionHandles { sh.stack = debug.Stack() } + p.mu.Unlock() } return sh }