Skip to content

Commit 7c31dc4

Browse files
tomwei7weicheng
and
weicheng
authored
Fix close canal client panic if use Execute after mysql host down (#858)
Co-authored-by: weicheng <[email protected]>
1 parent f0df38a commit 7c31dc4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

canal/canal.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,10 @@ func (c *Canal) Close() {
254254
c.cancel()
255255
c.syncer.Close()
256256
c.connLock.Lock()
257-
c.conn.Close()
258-
c.conn = nil
257+
if c.conn != nil {
258+
c.conn.Close()
259+
c.conn = nil
260+
}
259261
c.connLock.Unlock()
260262

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

0 commit comments

Comments
 (0)