Skip to content

Commit

Permalink
fix(spanner): early unlock of session pool lock during dumping the tr…
Browse files Browse the repository at this point in the history
…acked session handles to avoid deadlock (#5777)

* fix(spanner): early unlock of session pool lock during dumping the tracked session handles to avoid deadlock

* fix dirty read issue

* incorporate requested changes

Co-authored-by: Rahul Yadav <[email protected]>
  • Loading branch information
rahul2393 and rahul2393 authored Mar 23, 2022
1 parent dfda4d1 commit b007836
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion spanner/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ func (sh *sessionHandle) recycle() {
}
p := sh.session.pool
tracked := sh.trackedSessionHandle
sh.session.recycle()
s := sh.session
sh.session = nil
sh.trackedSessionHandle = nil
sh.checkoutTime = time.Time{}
sh.stack = nil
sh.mu.Unlock()
s.recycle()
if tracked != nil {
p.mu.Lock()
p.trackedSessionHandles.Remove(tracked)
Expand Down

0 comments on commit b007836

Please sign in to comment.