Send-Q和Recv-Q爆表,TCP连接卡死

问题

这是在电子书网站听书的时候遇到的,自己弄的Calibre-Web

昨天上班摸鱼,听着老友记钱德勒的自传,咔,听到传神处卡死。之后刷新,重启Calibre-Web后台服务,没任何效果。

Friends, Lovers, and the Big Terrible Thing

这个电子书网站只是表面,实际mp3,epub等文件都是存储在我家的NAS里的,经过各种骚操作,才能在网站上直接冒泡。

NAS(smb) -> raspberry pi(rinetd) -> zerotire -> vps(若干骚气的脚本)

这么干的好处就是成本低,大容量服务器太贵(现在都收集1T电子书了),况且这东西也就自己用,没必要。

全部配置细节等以后服务坏了,重新搭建的时候在记录。

进入侦探模式

唯一看透真相的是一个外表看似处男,智慧却过于常人的大水博主。

经过层层查找,找到一处异常,在Raspberry pi上执行命令:

netstat -ant

左边是Recv-Q,右边是Send-Q

我发现这两个数值一直在高位,即使在不听mp3的情况下,这就很奇怪了。为啥缓存不会消耗完???测试内网传输文件,观察Send-Q,Recv-Q状态,一切正常。

找到的相关解释​如下:

Why does data sit in Send-Q? TCP sessions freezing
Issue I run an IRC server for 20-50 users. We sometimes have issues with messages not arriving in a timely fashion or at all. After some packet captures we determined that messages sit in the serv…
Use of Recv-Q and Send-Q
What is the use of the Recv-Q and Send-Q columns in netstat’s output? How do I use use this in a realistic scenario? On my system, both of the columns are always shown as zero. What is the meaning…
Sockets - max size for send and receive buffers
For learning purpose I have created two simple C programms to simulate the following sockets scenario: a client in the loop sends 256 bytes to the server(send function with MSG_DONTWAIT flag) but the

重启rinetd端口映射服务:

systemctl stop rinetd.service
# 等几秒 关键中的关键
systemctl start rinetd.service

打开听书测试

问题解决,我真是个大聪明。

问题触发原因

以前正常使用没任何问题,最大可能就是昨天新加的电子书metatdata同步脚本引起的。在安装rinetd的时候,记得有人说这东西不稳定。

到底什么原因请看下集,嗯,大概率没有下集,爷们比较懒。