Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use of closed network connection #2

Closed
ghost opened this issue Mar 19, 2016 · 0 comments
Closed

use of closed network connection #2

ghost opened this issue Mar 19, 2016 · 0 comments

Comments

@ghost
Copy link

ghost commented Mar 19, 2016

@xtaci 您好,我在

426 packets transmitted, 359 received, 15% packet loss, time 425007ms
rtt min/avg/max/mdev = 343.108/485.715/644.402/77.218ms

的网络环境(欧洲aws实时发送数据=>北京阿里云收到后返回200,traceroute -I 显示18跳)下进行测试。

client端部署在欧洲aws上,连接 client端的是4个node进程,keepalive的超时时间设置为2分钟。
server端部署在国内阿里云上,阿里云机器的带宽是10M,server端转发给nginx(server和nginx在同一台机器),nginx直接返回200。

4个node进程刚启动后,其中三个进程的套接字会涨到200左右,然后回落到20,另一个稳定在40左右。
之后client出现下面信息:

2016/03/19 11:03:09 read tcp 127.0.0.1:54321->127.0.0.1:46589: use of closed network connection
2016/03/19 11:03:10 stream **opened**
2016/03/19 11:03:10 <nil>
2016/03/19 11:03:10 stream closed
2016/03/19 11:03:10 read tcp 127.0.0.1:54321->127.0.0.1:46590: use of closed network connection
2016/03/19 11:03:11 stream opened
2016/03/19 11:03:11 <nil>
2016/03/19 11:03:11 stream closed
2016/03/19 11:03:11 read tcp 127.0.0.1:54321->127.0.0.1:46591: use of closed network connection
2016/03/19 11:03:11 stream opened
2016/03/19 11:03:11 <nil>
2016/03/19 11:03:11 stream closed
2016/03/19 11:03:11 read tcp 127.0.0.1:54321->127.0.0.1:46592: use of closed network connection
2016/03/19 11:03:12 stream opened
2016/03/19 11:03:12 <nil>
2016/03/19 11:03:12 stream closed
2016/03/19 11:03:12 read tcp 127.0.0.1:54321->127.0.0.1:46593: use of closed network connection
2016/03/19 11:03:12 <nil>
2016/03/19 11:03:12 stream closed
2016/03/19 11:03:12 read tcp 127.0.0.1:54321->127.0.0.1:46594: use of closed network connection
2016/03/19 11:03:12 stream opened
2016/03/19 11:03:12 <nil>
2016/03/19 11:03:12 stream closed

查看套接字,前三个进程的套接字还是稳定在20,另一个由40涨到200左后,最后降到20.,同时4个node 程序无法向client发送数据,出现异常信息

socket hang up

node 进程由pm2 守护,程序对异常有处理,当发生这类异常时,会尝试重新发送,但一直没能成功。

发送的数据大小平均为52981字节。

请问:

  1. 发生use of closed network connection的原因是什么,如何解决?(我之前加了连接池,可以避免这个错误的发生,但觉得不是最好的解决方案);
  2. 在这样的网络环境下,kcp的一些参数比如像窗口size的大小,怎样设置比较合理,依据是什么;
  3. 正常发送的数据大小大约是211924(测试时的4倍)字节,这样的数据大小kcp调整参数后,是否可以发送?(我尝试过2倍,发送不成功,卡住了。具体原因还没查)

期待您的回复,非常感谢!

@ghost ghost closed this as completed Mar 23, 2016
@xtaci xtaci mentioned this issue Apr 7, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants