Linux 服务器 message 日志报错:kernel: TCP: time wait bucket table overflow

  • A+
所属分类:Linux
高性能企业级服务器首台5折

问题现象


云服务器 ECS ping 外部 IP 丢包,ping 出现错误:

  1. 1
    <span class="pln">ping</span><span class="pun">:</span><span class="pln"> sendmsg</span><span class="pun">:</span> <span class="typ">Operation</span><span class="pln"> not permitted</span>

同时,查询服务器 /var/log/message 日志,发现大量类似如下错误信息:

  1. 1
    <span class="typ">Aug</span>  <span class="lit">4</span> <span class="lit">17</span><span class="pun">:</span><span class="lit">25</span><span class="pun">:</span><span class="lit">37</span><span class="pln"> static1 kernel</span><span class="pun">:</span><span class="pln"> TCP</span><span class="pun">:</span><span class="pln"> time <span class="hljs-built_in">wait</span> bucket table overflow</span>
  2. 1
    <span class="typ">Aug</span>  <span class="lit">4</span> <span class="lit">17</span><span class="pun">:</span><span class="lit">25</span><span class="pun">:</span><span class="lit">37</span><span class="pln"> static1 kernel</span><span class="pun">:</span><span class="pln"> TCP</span><span class="pun">:</span><span class="pln"> time <span class="hljs-built_in">wait</span> bucket table overflow</span>

问题原因


系统 TCP TIME WAIT溢出。

处理办法


  1. 通过如下指令可以统计当前的 TCP 连接数:
  1. 1
    <span class="pln">netstat </span><span class="pun">-</span><span class="pln">anp </span><span class="pun">|</span><span class="pln">grep tcp </span><span class="pun">|</span><span class="pln">wc </span><span class="pun">-</span><span class="pln">l </span>
  1. 对比 /etc/sysctl.conf 配置文件中参数 net.ipv4.tcp_max_tw_buckets 值,看是否有超出情况。

  2. 如果确认已经超出,则可以编辑 /etc/sysctl.conf 配置文件,根据系统规格,适当调大 net.ipv4.tcp_max_tw_buckets 参数值

说明:

  • 该参数并非支持无限调高,具体支持的调整值,和服务器的规格(带宽、CPU)有关。
  • 如果调高后,还是持续保持,则评估是否是正常业务流量。 如果是正常业务流量,则建议在服务器前端引入 负载均衡 等服务来进行流量分发,以降低单台服务器的流量负载。

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: