TIDB连接被动关闭

应用程序偶尔会发生连接异常:报Connection must be valid and open.
TIDB服务端会看的异常信息:
[2023/12/21 16:46:14.535 +08:00] [WARN] [simple.go:2549] [“Kill failed: Received a 32bits truncated ConnectionID, expect 64bits. Please execute ‘KILL [CONNECTION | QUERY] ConnectionID’ to send a Kill without truncating ConnectionID.”] [connID=3823]

[2023/12/21 16:46:18.328 +08:00] [ERROR] [terror.go:315] [“encountered error”] [error=“write tcp XXXX:4003->XXXX:47643: write: connection reset by peer”] [stack=“github.com/pingcap/tidb/parser/terror.Log\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/parser/terror/terror.go:315\ngithub.com/pingcap/tidb/server.(*packetIO).writePacket\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/packetio.go:190\ngithub.com/pingcap/tidb/server.(*clientConn).writePacket\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:446\ngithub.com/pingcap/tidb/server.(*clientConn).writeChunks\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2388\ngithub.com/pingcap/tidb/server.(*clientConn).writeResultset\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2285\ngithub.com/pingcap/tidb/server.(*clientConn).handleStmt\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2152\ngithub.com/pingcap/tidb/server.(*clientConn).handleQuery\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1972\ngithub.com/pingcap/tidb/server.(*clientConn).dispatch\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1403\ngithub.com/pingcap/tidb/server.(*clientConn).Run\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1152\ngithub.com/pingcap/tidb/server.(*Server).onConn\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/server.go:648”]

连接断开,connect reset by peer,意识是对端peer回复了TCP RST(reset),终止了一次连接。发生这个问题的原因有很多,比如网络不稳定、或者防火墙来几个 RST,也都有可能导致类似的 connection reset by peer 的问题。一般需要具体抓包具体分析。

1 个赞

出现这个报错,表示连接到tidb server的TCP连接被另一端断开了,导致tidb server在返回数据或者做出其他请求响应的时候出错了。

请排查网络是否有抖动、是否有发送到tidb server的探活请求、业务是否有未返回数据时就提前主动断开的场景,以及其他可能的问题

1.先确定上面这个ip是不是报错的应用服务器,时间是否吻合。
2.开个长ping关注下网络抖动。
3.中间有没有haproxy之类的探活,如果有可以参考下这[1]

感觉 连接被重置了

如果不是客户端直接访问tidb 检查是否有代理超时设置,防火墙超时设置

此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。