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

Alpine Linux 的 TCP 连接数溢出 #110

Closed
i207M opened this issue Nov 28, 2022 · 8 comments
Closed

Alpine Linux 的 TCP 连接数溢出 #110

i207M opened this issue Nov 28, 2022 · 8 comments

Comments

@i207M
Copy link
Contributor

i207M commented Nov 28, 2022

版本:最新 v1.5.7(之前版本也有此问题)

Alpine Linux 上的 Rust 客户端回报的 TCP/UDP 连线数为4294967295,怀疑是uint溢出导致的。
这一现象其实在 #18 (comment) 中也有显示:\"tcp\":4294967295,

截图:

image

@zdz
Copy link
Owner

zdz commented Nov 28, 2022

Alpine Linux 是哪个版本?贴一下下面几个命令的输出看看

ss --version
ss -t | wc -l
ss -u | wc -l
ps -ef | wc -l
ps -eLf | wc -l

@i207M
Copy link
Contributor Author

i207M commented Nov 28, 2022

470:~# ss --version
ss utility, iproute2-5.17.0
470:~# ss -t | wc -l
5
470:~# ss -u | wc -l
1
470:~# ps -ef | wc -l
19
470:~# ps -eLf | wc -l
ps: unrecognized option: L
BusyBox v1.35.0 (2022-06-11 16:59:22 UTC) multi-call binary.

Usage: ps [-o COL1,COL2=HEADER] [-T]

Show list of processes

        -o COL1,COL2=HEADER     Select columns for display
        -T                      Show threads
0
470:~# ps -ef | wc -l
19

@zdz
Copy link
Owner

zdz commented Nov 28, 2022

let t = exec_shell_cmd_fetch_u32!("ss -t | wc -l") - 1;

统计完结果数要-1/-2, 看着应该是有的是溢出了,有的是ps 命令参数不兼容,先用参数 --disable-tupd 禁用掉吧

@i207M
Copy link
Contributor Author

i207M commented Nov 28, 2022

可能还有一个原因,就是我直接在alpine linux上无法运行ss,需要先安装apk add iproute2。也许需要把它加入依赖。

@zdz
Copy link
Owner

zdz commented Nov 28, 2022

可能还有一个原因,就是我直接在alpine linux上无法运行ss,需要先安装apk add iproute2。也许需要把它加入依赖。

是的需要加入依赖,本质上是跑 ss,ps 命令, 然后取的结果

@i207M
Copy link
Contributor Author

i207M commented Nov 28, 2022

安装之后显示为:TCP/UDP/进/线: 5 / 0 / 16 / 4294967294

let d = exec_shell_cmd_fetch_u32!("ps -eLf | wc -l") - 2;

第四个数字的原因应该是这一行在alpine中报错。因为alpine的ps指令不支持-L

@zdz
Copy link
Owner

zdz commented Nov 28, 2022

跑一下这个,装上 ps 就可以了

apk add procps iproute2 coreutils

@i207M
Copy link
Contributor Author

i207M commented Nov 28, 2022

Cool. Thanks.

@zdz zdz closed this as completed Dec 3, 2022
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

2 participants