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

老是提示 创建文件[result.csv]失败 #518

Closed
azyghqsavx opened this issue Jun 4, 2024 · 1 comment
Closed

老是提示 创建文件[result.csv]失败 #518

azyghqsavx opened this issue Jun 4, 2024 · 1 comment
Labels
反馈问题 某些功能失效 或 没有达到预期

Comments

@azyghqsavx
Copy link

azyghqsavx commented Jun 4, 2024

问题描述

root@Admin:~/CloudflareST# ./CloudflareST -tl 100 -sl 10 -tlr 0 -t 10 -n 50 -dn 1000 -p 1000
# XIU2/CloudflareSpeedTest v2.2.5

开始延迟测速(模式:TCP, 端口:443, 范围:0 ~ 100 ms, 丢包:0.00)
5955 / 5955 [---------------------------------------------------------------------------------------------] 可用: 3116
开始下载测速(下限:10.00 MB/s, 数量:1000, 队列:3112)
0 / 1000 [________________________________________________________________________________________________]
2024/06/04 10:08:33 创建文件[result.csv]失败:open result.csv: too many open files
root@Admin:~/CloudflareST# ./CloudflareST -tl 100 -sl 10 -tlr 0 -t 10 -n 50 -dn 1000 -o 01.txt
# XIU2/CloudflareSpeedTest v2.2.5

开始延迟测速(模式:TCP, 端口:443, 范围:0 ~ 100 ms, 丢包:0.00)
5955 / 5955 [---------------------------------------------------------------------------------------------] 可用: 3116
开始下载测速(下限:10.00 MB/s, 数量:1000, 队列:3112)
0 / 1000 [________________________________________________________________________________________________]
2024/06/04 08:24:22 创建文件[01.txt]失败:open 01.txt: too many open files

软件版本

v2.2.5

附加截图

No response

@azyghqsavx azyghqsavx added the 反馈问题 某些功能失效 或 没有达到预期 label Jun 4, 2024
@XIU2
Copy link
Owner

XIU2 commented Jun 5, 2024

这是因为系统设定的进程文件句柄数耗尽了(默认 1024)。

正常情况下 CloudflareST 是不会超过默认值 1024 的,但我根据你提供的信息来看,猜测可能是因为下载测速数量太多导致的。

你延迟测速得到了 3116 个未超时的 IP,然后根据延迟测速条件(0 ~ 100 ms)过滤后剩下 3112 个 IP,接下来就会挨个进行下载测速(默认参数情况下是只会下载测速延迟最低的前十个 IP)。
但你设定了下载测速条件,要求找到 1000 个速度不低于 10MB/s 的 IP,那么最后结果几乎可以肯定这是不可能的,这就会导致 CloudflareST 会把这 3112 个 IP 全部下载测速一遍(只要没有满足要求,就会一直测速下去,直到全部测速完)。

而这个数量太多了一些,等到全部测完要写入 result.csv 文件时,早就因为进程文件句柄数耗尽了而无法写入了。

而且从你提供的信息中可以看到,即使 CloudflareST 把这 3112 个 IP 都下载测速了一遍,却依然一个超过 10MB/s 的 IP 都没有,所以显然你指定的条件是不适合的,需要调低预期才行。


解决方法一:

指定合适的测速条件参数。


解决方法二:

提高系统设置的进程文件句柄数上限(但没啥用,只是单纯解决最后写入结果文件报错 too many open files 的问题)。

临时提高(重启后恢复为 1024)

ulimit -n 65535

永久提高(重启后依然为 65535,想要恢复就打开文件后手动删除即可)

echo "* soft nofile 65535
* hard nofile 65535
root soft nofile 65535
root hard nofile 65535" >> /etc/security/limits.conf

@XIU2 XIU2 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
反馈问题 某些功能失效 或 没有达到预期
Projects
None yet
Development

No branches or pull requests

2 participants