From 5462a0f20685966decb1de048839414718b3ffba Mon Sep 17 00:00:00 2001 From: tangenta Date: Tue, 30 Apr 2024 09:24:02 +0800 Subject: [PATCH 1/2] set read deadline for new conection to fix handshake stuck --- replication/binlogsyncer.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/replication/binlogsyncer.go b/replication/binlogsyncer.go index 0de77522a..066bfb1a2 100644 --- a/replication/binlogsyncer.go +++ b/replication/binlogsyncer.go @@ -900,6 +900,9 @@ func (b *BinlogSyncer) newConnection(ctx context.Context) (*client.Conn, error) "", b.cfg.Dialer, func(c *client.Conn) { c.SetTLSConfig(b.cfg.TLSConfig) c.SetAttributes(map[string]string{"_client_role": "binary_log_listener"}) + if b.cfg.ReadTimeout > 0 { + c.SetReadDeadline(time.Now().Add(b.cfg.ReadTimeout)) + } }) } From 0ff5b1456d4236611e15fd8625153be3b0eb7f50 Mon Sep 17 00:00:00 2001 From: tangenta Date: Tue, 30 Apr 2024 10:13:46 +0800 Subject: [PATCH 2/2] fix linter --- replication/binlogsyncer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/replication/binlogsyncer.go b/replication/binlogsyncer.go index 066bfb1a2..72a22c45c 100644 --- a/replication/binlogsyncer.go +++ b/replication/binlogsyncer.go @@ -901,7 +901,7 @@ func (b *BinlogSyncer) newConnection(ctx context.Context) (*client.Conn, error) c.SetTLSConfig(b.cfg.TLSConfig) c.SetAttributes(map[string]string{"_client_role": "binary_log_listener"}) if b.cfg.ReadTimeout > 0 { - c.SetReadDeadline(time.Now().Add(b.cfg.ReadTimeout)) + _ = c.SetReadDeadline(time.Now().Add(b.cfg.ReadTimeout)) } }) }