shadowsocks-rust: CLOSE-WAIT bug
./ssserver -s "[::]:1" -m "aes-256-gcm" -k "pass" -U --tcp-no-delay --tcp-keep-alive 120 --udp-timeout 60
./sslocal --protocol tun -s "[2a01:1700:2::7:18b]:1" -m "aes-256-gcm" -k "pass" --outbound-bind-interface pppoe-wan --tun-interface-name tun0 -U --tcp-no-delay --tcp-keep-alive 120 --udp-timeout 60
查看netstat -an
服务端被连接放出现了CLOSE-WAIT
明显程序有问题.
tcp CLOSE-WAIT 0 0 [2a01:1700:2::7:18b]:1 [2a08:a220:9a17:bcb0::1]:57902
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 4
- Comments: 26 (1 by maintainers)
Instead of obsessing with stats you don’t understand and opening useless issues, you should take some time to learn some networking basics.
一方主动关闭了连接,就要主动释放另一端连接.
一方都主动关闭了连接,你保持连接就会继续传输数据嘛?
realm早期版本也存在 CLOSE-WAIT 的问题,后来的版本就解决了.
io对拷出的问题,没有正确释放另外一端, 而golang有个defer, 是无条件可以触发的, 所以golang项目不存在CLOSE-WAIT,
https://github.com/zhboner/realm/issues/87
cargo build --release --features 'brutal-shutdown'增加 brutal-shutdown 编译选项后,测试无问题了他底层socket没有使用tokio的,是他自己写的,调用了c的原生接口,就没有close-wait
有没有问题,自己多看看书噢,
FIN-WAIT-1 FIN-WAIT-2 存在一会是正常的, 但是CLOSE-WAIT一直存在,就是程序问题.
@database64128
如果close-wait一闪即逝是正常的,但是一直需要等待就不是正常的, 你应该多去学习一下.
golang c项目都没问题.
https://docs.rs/tokio/latest/tokio/net/struct.TcpStream.html
这个玩意有bug,有人提过,但是没解决.
https://github.com/zhboner/realm/issues/87
可以参考一下这个,之前realm之前也存在这种问题,后来作者修复了,