iocp中GetQueuedCompletionStatus 121 信号灯超时时间已到 (error sem timeout)

报错 :121 信号灯超时时间已到 (error sem timeout)

现象和 http://bbs.csdn.net/topics/370175898 描述一致

现象:GetQueuedCompletionStatus 返回后,GetLastError = 121 (信号灯超时时间已到),出现这个提示后,服务程序变卡,客户端不能流畅的接收数据;没有这个错误则客户端接收流畅。

代码如下

void App::AnalysisCommand(const boost::system::error_code& error,size_t bytes_recvd)
{
    if(!error && bytes_recvd > 0)
    {
    ........
boost::asio::async_read(socket_, boost::asio::buffer(m_buff, sizeof(MessageHeader)), boost::bind(&App::AnalysisCommand, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); } else { LOG_ERROR<<"socket receive error message:"<< error.value()<<error.message();
} }

 

http://bbs.csdn.net/topics/370175898

https://blogs.msdn.microsoft.com/oldnewthing/20140717-00/?p=483/

http://microsoft.public.win32.programmer.networks.narkive.com/YVjj9q6G/calls-to-getqueuedcompletionstatus-returns-error-netname-deleted-or-error-sem-timeout#post1

http://blog.csdn.net/brook0344/article/details/60479590

根据csdn上那哥们说的,ERROR_SEM_TIMEOUT 每秒收到5000个以上的Accept时出现

 

------解决方案--------------------
我用IOCP做服务器,运行几天出现的.
我的情况是:使用完成端口模型作服务器,当GetQueuedCompletionStatus的时候
偶尔会出现
ERROR_CONNECTION_ABORTED 由本地系统终止网络连接
ERROR_SEM_TIMEOUT 信号灯超时时间已到。
样的错误,同时服务器能够接受连接但是不能write/read数据,除了线程被阻塞意外还有什么可能呢?
请各位大大帮忙提点提点 ..

 

可能引起连接问题的最常见原因有:

•    网络适配器和交换机端口的双工级别或传输速度设置不匹配。
•    传输速率为 10/100 兆比特每秒 (Mbps) 的网络适配器或交换机无法正常交换。有些自动探测设置不能正确检测某些网络适配器的速度。
•    网络适配器与母板或其他的硬件或软件组件和驱动程序不兼容。
典型的错误信息有:
Error 55:"The specified network resource is no longer available" (ERROR_DEV_NOT_EXIST).
Error 64:"The specified network name is no longer available" (ERROR_NETNAME_DELETED).
Error 121:"The semaphore timeout period has expired" (ERROR_SEM_TIMEOUT).
Error 1231:"The remote network is not reachable by the transport" (ERROR_NETWORK_UNREACHABLE).

http://www.lai18.com/content/1812488.html

 

有人说一般是tcp三次握手失败导致的,那问题引起的原因就可能有点多,网络不好,网络断开.....

 

posted @ 2017-06-28 16:48  balder_m  阅读(6727)  评论(1编辑  收藏  举报