Skip to content

Commit

Permalink
fix(spanner): handle nil error when cleaning up long running session (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul2393 authored Nov 29, 2023
1 parent a1aecb0 commit a93bc26
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spanner/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,12 @@ func (p *sessionPool) getLongRunningSessionsLocked() []*sessionHandle {
for element != nil {
sh := element.Value.(*sessionHandle)
sh.mu.Lock()
if sh.session == nil {
// sessionHandle has already been recycled/destroyed.
sh.mu.Unlock()
element = element.Next()
continue
}
diff := time.Now().Sub(sh.lastUseTime)
if !sh.eligibleForLongRunning && diff.Seconds() >= p.idleTimeThreshold.Seconds() {
if (p.ActionOnInactiveTransaction == Warn || p.ActionOnInactiveTransaction == WarnAndClose) && !sh.isSessionLeakLogged {
Expand Down

0 comments on commit a93bc26

Please sign in to comment.