Skip to content

Commit

Permalink
Fix close canal client panic if use Execute after mysql host down
Browse files Browse the repository at this point in the history
  • Loading branch information
weicheng authored and tomwei7 committed Apr 22, 2024
1 parent f0df38a commit 741c00f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions canal/canal.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,10 @@ func (c *Canal) Close() {
c.cancel()
c.syncer.Close()
c.connLock.Lock()
c.conn.Close()
c.conn = nil
if c.conn != nil {
c.conn.Close()
c.conn = nil
}
c.connLock.Unlock()

_ = c.eventHandler.OnPosSynced(nil, c.master.Position(), c.master.GTIDSet(), true)
Expand Down

0 comments on commit 741c00f

Please sign in to comment.