Skip to content

Commit

Permalink
store nil backendIO after OnConnClose, because OnConnClose may call b…
Browse files Browse the repository at this point in the history
…ackendIO conn like ServerAddr()

Signed-off-by: whl <wanghongliang@pingcap.com>
  • Loading branch information
better0332 committed May 12, 2023
1 parent d0e6292 commit 2851059
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/proxy/backend/backend_conn_mgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,13 +636,13 @@ func (mgr *BackendConnManager) Close() error {
var connErr error
var addr string
mgr.processLock.Lock()
if backendIO := mgr.backendIO.Swap(nil); backendIO != nil {
if backendIO := mgr.backendIO.Load(); backendIO != nil {
addr = backendIO.RemoteAddr().String()
connErr = backendIO.Close()
}
mgr.processLock.Unlock()

handErr := mgr.handshakeHandler.OnConnClose(mgr)
mgr.backendIO.Store(nil)
mgr.processLock.Unlock()

eventReceiver := mgr.getEventReceiver()
if eventReceiver != nil {
Expand Down

0 comments on commit 2851059

Please sign in to comment.