Comments (10)
基本上,只要数据收发还正常的情况下,如果把 nginx 重启,就会重现。
from muduo.
为什么你认为这是muduo的问题,而不是nginx的问题?
tcpdump 有没有说是谁主动断开连接?
from muduo.
现在还没有抓包分析,不过 TcpClient 的重连频率还是很高,基本和死循环一样。
from muduo.
从你给的log看,重连的间隔有0.5s。这有什么问题?
from muduo.
两个截图,一个是完成了整个连接和关闭过程。
一个是完成了连接,没有完整关闭过程。
重连的时间间隔没有预期的指数回退,就是一直在连接。
当然,确实是服务器先主动关闭连接。
from muduo.
传图
from muduo.
上图上不去,只能上客户端 log 了。
20150324 01:33:24.123149Z 22876 INFO TcpClient::connect[ChatClient] - Reconnecting to 169.254.10.12:26888 - TcpClient.cc:178
20150324 01:33:24.123219Z 22876 INFO 169.254.10.12:60264 -> 169.254.10.12:26888 is UP - client.cc:53
20150324 01:33:24.123233Z 22876 INFO 169.254.10.12:60264 -> 169.254.10.12:26888 is DOWN - client.cc:53
20150324 01:33:24.123239Z 22876 INFO TcpClient::connect[ChatClient] - Reconnecting to 169.254.10.12:26888 - TcpClient.cc:178
20150324 01:33:24.123311Z 22876 INFO 169.254.10.12:60265 -> 169.254.10.12:26888 is UP - client.cc:53
20150324 01:33:24.123324Z 22876 INFO 169.254.10.12:60265 -> 169.254.10.12:26888 is DOWN - client.cc:53
from muduo.
因为服务器端主动关闭了连接,而每次客户端也析构了连接对象,导致 Connector 类每次都使用
初始化的kInitRetryDelayMs值来计算连接时间间隔,而无法不断累计时间,导致客户端就和死循环一样,
没有很优雅的不断增加连接时间间隔,两边都陷入雪崩的情况。客户端作死连接,服务器拼命关闭。
from muduo.
因为每次连接都成功了,客户端没有进入连接失败,所以
void TcpClient::removeConnection(const TcpConnectionPtr& conn)
函数内部执行了 connector_->restart(); 去重新连接。
客户端作死连接,服务器拼命关闭。
不知道这种情况,客户端是否要规避。
from muduo.
我认为问题出在server端,TcpClient没有问题。
from muduo.
Related Issues (20)
- TcpConnection在read为0时是被动的关闭连接,如果此时服务端有数据仍然未发送咋办?
- 编译错误 HOT 1
- muduo样例 chatserver:读取客户端数据 报段错误 HOT 3
- 您好 我想咨询下 您这个目前支持post方法了么
- 是否考虑改为google的风格
- shared_from_this与this
- TcpClient客户端tcpconnection.forceClose(),onconnect回调函数收到断联的消息后coredump HOT 3
- 现在支持在Mac环境下编译运行么 HOT 1
- 请问一下:exception caught in Thread reason: call to empty boost::function Aborted (core dumped) HOT 2
- muduo::net::Buffer中有unread方法吗 HOT 3
- muduo Buffer类单独测试爆undefined HOT 2
- addTimer 为什么是线程安全的,通过什么写法实现的? HOT 1
- error: ‘setTimeZone’ is not a member of ‘muduo::Logger’
- stackTrace HOT 2
- 是否支持http 1.1 管线化 HOT 1
- bug: Timer callbacks may still be invoked even after the timer has been canceled HOT 1
- base/test/logging_test.cc编译后运行遇到了段错误 HOT 1
- difference between muduo and glog?
- About TimerQueue's CancelInLoop
- 性能测试,chargen,netty,ttcp等测试带宽大概897Mbps为什么比iperf3的 941 Mbits/sec要小一些 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from muduo.