首批通过分布式安全可靠测评,为关键业务系统打造
断链报错 "Read timed out" 的问题排查
更新时间:2026-06-04 01:56
问题现象
应用使用 ODP-Sharding 连接 OceanBase 数据库,业务执行报错:Server connection execute error: Read timed out。

问题原因
SQL 执行较慢,触发了 Socket timeout。
排查步骤
查看 ODP comm-error 日志,发现有报错:
Communications link failure,显示链接在空闲 5 秒后报错。Communications link failure The Last packet successfully received from the server was 5,008 milliseconds ago. The last packet sent successfully to the server was 5,005 milliseconds ago.查看 ODP digest 日志,查看 SQL 执行的具体耗时信息,看到 SQL 执行了 5023474 us,即 5 秒。
2024-01-30 16:00:23,632,14031ca31706601614999100516596,xx.xx.xx.xx,db_xx,dpst...,UPDATE,/* -DBP: $SYS=(TRACE (14031ca31706601614999100516596#xx.xx.xx.xx))*//*+DBP: §ROUTE={GROUP ID (29) &2CTABLE NAME (dpst...))* /UPDATE dpst... SET ... N,Y,x0e45035317066016185932701,N,0,5023474,42,34,74,2,0,0,tb_xx,0查看 OBProxy digest 日志,看到 SQL 执行了 5005400 us,即 5 秒,然后失败。
2024-01-30 16:00:23.614698, undefined...dpst...,OB_MYSQL.,dpst...,COM_QUERY,UPDATE,failed,UPDATE dpst... SET ...5005400us,22us,0us,0us,Y0-7FC9A384EC90查看 OCP 中 SQL 监控信息,看到该语句在数据库中的耗时超过 5 秒。说明 SQL 执行耗时超过 5 秒,触发了 socket timeout。
解决方法
对 SQL 进行调优。
调整 socket timeout 设置。
适用版本
OceanBase 数据库所有版本。