问题描述
在 CentOS 7 系统上,C++ 应用程序在 close_wait 状态下连接挂断,守护进程停止响应网络流量.我的理解是内核处理 TCP 堆栈管理并负责获取这些连接.
什么可能导致这些连接挂断,我应该在这个软件中寻找什么类型的错误?例如,
在这个序列图中,服务器在收到 FIN 后进入 CLOSE_WAIT 状态,并保持该状态直到它调用 close.
On a CentOS 7 system, C++ application is having connections hang up in the close_wait state and the daemon stops responding to network traffic. My understanding is that the Kernel handles the TCP stack management and is responsible for reaping these connections.
What could cause these connections to get hung up and what types of bugs should I be looking for in this software? For example, might the application be failing to shut down the socket, or might something else be going on?
The software running on the end where you see the connections in the CLOSE_WAIT state is not closing the sockets (for example, explicitly calling close()) after receiving FINs from other side.
CLOSE_WAIT state means that the connection is in half-close state, that is, the other end closed its side of the connection but this end did not. This is completely valid in TCP since connections are full-duplex.
In this sequence diagram, server enters the CLOSE_WAIT state after receiving the FIN, and will remain in that state until it calls close.
这篇关于什么会导致连接挂在 close_wait 状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!