Closed egg1234 closed 12 months ago
这是因为不少 Linux 发行版的 Open Files 数量限制为 1024,所以很容易会遇到这种问题。
临时解决办法:
ulimit -n
,查看输出的数值。这个数值几乎都是 1024。ulimit -n 300000
永久解决办法: 编辑 /etc/security/limits.conf,在末尾加上
* hard nofile 300000
* soft nofile 300000
root hard nofile 300000
root soft nofile 300000
更改了客户端ubutnu 20系统的Open Files数值 ulimit -n 300000
服务器监听端口范围改小到 listen_port=11000-11100
客户端 destination_port=11000-11100 mux_tunnels=500
两边启动后客户端不断报下面的错误,但开始即使报错好像可以使用一次转发,之后就不能转发了
[2023-10-03 10:30:58 +0000] KCP conv is not the same as record : conv = 3413772101, local kcp : 1066320723 [2023-10-03 10:30:58 +0000] KCP conv is not the same as record : conv = 0, local kcp : 2965190177 [2023-10-03 10:30:59 +0000] KCP conv is not the same as record : conv = 0, local kcp : 2965190177 [2023-10-03 10:31:00 +0000] KCP conv is not the same as record : conv = 0, local kcp : 2965190177 [2023-10-03 10:32:02 +0000] KCP conv is not the same as record : conv = 3469647057, local kcp : 3459109078 [2023-10-03 10:32:03 +0000] KCP conv is not the same as record : conv = 2175946252, local kcp : 3930183083 [2023-10-03 10:32:04 +0000] KCP conv is not the same as record : conv = 1802855575, local kcp : 359129512 [2023-10-03 10:32:04 +0000] KCP conv is not the same as record : conv = 3469647057, local kcp : 3459109078 [2023-10-03 10:32:06 +0000] KCP conv is not the same as record : conv = 2175946252, local kcp : 3930183083 [2023-10-03 10:32:09 +0000] KCP conv is not the same as record : conv = 2175946252, local kcp : 3930183083 [2023-10-03 10:32:10 +0000] KCP conv is not the same as record : conv = 1802855575, local kcp : 359129512 [2023-10-03 10:32:10 +0000] KCP conv is not the same as record : conv = 3469647057, local kcp : 3459109078 [2023-10-03 10:32:14 +0000] KCP conv is not the same as record : conv = 0, local kcp : 3579815534 Insufficient input for GCM decryption, tag missing Invalid authentication tag: GCM tag check failed Invalid authentication tag: GCM tag check failed [2023-10-03 10:32:58 +0000] KCP conv is not the same as record : conv = 0, local kcp : 1149376605 Invalid authentication tag: GCM tag check failed Invalid authentication tag: GCM tag check failed Invalid authentication tag: GCM tag check failed Invalid authentication tag: GCM tag check failed
然后服务器端启动一个socks5代理 ./gost -L=:6000
客户端测试使用,第一次可以连通并正常返回内容,第二次没有反应,并且服务器端的gost没有看到有客户端的连接申请,这时客户端的kcptube继续不断报上面的错误信息 curl -x http://127.0.0.1:6000 https://clients3.google.com
这两台ubuntu机器,同样的线路,使用hysteria端口跳跃并做端口转发gost代理没有任何问题,使用juicity做端口转发gost代理也没有任何问题
mux_tunnels=500 这个设置有点多,先降到5~10试试,大多数情况下是够用的
客户端设置mux_tunnels=5,之后客户端就没有报错出现,晚高峰测试上面的代理方式,长时间播放8k及4k视频非常稳定
而且最后发现如果设置mux_tunnels=5,即使是系统缺省的open files (-n) 1024也不会报错
另外建议是说明里面应该提醒一下使用linux正式发行版的用户,应该把mux_tunnels及系统open files的因素关联考虑,大概多少mux_tunnels对应多少open files数的一个比例,而且也说明一下mux_tunnels设置很大数值时的应用场合,以免像我这种小白胡乱就配上去了
最后是非常感谢大佬写出如此优秀的项目!
kcptube-linux-glibc-x64.tar.xz 服务端及客户端操作系统都是ubuntu 20.04.6服务器版(非桌面版)
root用户启动
./kcptube kcpclient.conf
客户端报告错误 kcptube version 20230924 Error Found in Configuration File(s): No Servers: 0 Relays: 0 Clients: 1 start_up() running in client mode [2023-09-25 11:11:11 +0000] open: Too many open files
如果是kcptube-linux-musl-x64.tar.bz2版 报告错误 open: No file descriptors available
系统open files数是缺省的,没有改变过
# ulimit -a
core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 3491 max locked memory (kbytes, -l) 65536 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 3491 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited下面是服务器的配置文件内容,服务器没有报错
mode=server kcp=fast1 inbound_bandwidth=500M outbound_bandwidth=500M listen_port=11000-11999 destination_port=6000 destination_address=127.0.0.1 dport_refresh=20 encryption_password=password encryption_algorithm=AES-GCM keep_alive=10 ipv4_only=1
下面是客户端的配置文件内容
mode=client kcp=fast1 inbound_bandwidth=450M outbound_bandwidth=50M listen_port=6000 destination_port=11000-11999 destination_address=www.mydomain.com dport_refresh=20 encryption_password=password encryption_algorithm=AES-GCM keep_alive=10 ipv4_only=1 mux_tunnels=65535
上面的mux_tunnels=1020也一样的报错
请教一下应该怎样修改参数才能运行
谢谢!