Skip to content

Commit a93bc26

Browse files
authored
fix(spanner): handle nil error when cleaning up long running session (#9052)
1 parent a1aecb0 commit a93bc26

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

spanner/session.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,12 @@ func (p *sessionPool) getLongRunningSessionsLocked() []*sessionHandle {
724724
for element != nil {
725725
sh := element.Value.(*sessionHandle)
726726
sh.mu.Lock()
727+
if sh.session == nil {
728+
// sessionHandle has already been recycled/destroyed.
729+
sh.mu.Unlock()
730+
element = element.Next()
731+
continue
732+
}
727733
diff := time.Now().Sub(sh.lastUseTime)
728734
if !sh.eligibleForLongRunning && diff.Seconds() >= p.idleTimeThreshold.Seconds() {
729735
if (p.ActionOnInactiveTransaction == Warn || p.ActionOnInactiveTransaction == WarnAndClose) && !sh.isSessionLeakLogged {

0 commit comments

Comments
 (0)