Shadowsocks-libev: 使用 c-ares 代替 udns 时引入的 bug

Created on 18 Sep 2017  ·  19Comments  ·  Source: shadowsocks/shadowsocks-libev

在 commit ID 为 ede744ae7c79dfc91e93c3eca31b00fd6f951fc6 的这次提交中,使用了 c-area 代替了 udns, 引入的 bug 为不能正确处理 resolve.conf 中的 options 参数,结果就是, TCP Handshake 时间正常,但是响应时间大幅增加。

third-party bug

Most helpful comment

@chunh 阿里云的resolvconf配置 加了一行这个参数:options timeout:1 attempts:1 rotate 引发了这个bug,可以按照下面步骤消除:
修改 /etc/resolvconf/resolv.conf.d 文件,注释掉option那一行:
#options timeout:1 attempts:1 rotate
建议同时将阿里的DNS换成google的:

nameserver 100.100.2.138
nameserver 100.100.2.136

改成:

nameserver 8.8.8.8
nameserver 8.8.4.4

最后重启

All 19 comments

不能正确处理 resolve.conf 中的 options 参数

想要正确处理resolv,用最新cares,新版本把bug都修了

另外options的部分贴出来

@wongsyrone

nameserver 8.8.8.8
options timeout:1 attempts:1 rotate

写成

options timeout:1
options attempts:1
options rotate

改完之后重启ss

我是直接删除 options 参数使用的

那就没意思了,测试的就是options,另外从你那个配置来看超时是1秒,你确定1秒之内能有返回么?而且重试次数1次,除非你网络非常好,不然别用这种太激进的配置,开了rotate要确保每个server都很好,关掉rotate就会永远从第一个server开始。其他的去看manpage

nameserver 100.100.2.138
nameserver 100.100.2.136
options timeout:30 attempts:3 rotate
默认为如此
timeout:1 attempts:1 是当时使用 git biect 跟踪到 bug 时实验极端情况时使用的

你好,请问这个怎么解决呢
使用 3.1.0
使用系统
client mac osx 10.12.6 server ubuntu 16.04
libc-ares的版本
libc-ares-dev is already the newest version (1.10.0-3ubuntu0.2)

上面应该是最新版本的目前使用中响应也是缓慢

1.10.0不是最新版本 重新编译 https://github.com/c-ares/c-ares

@AnyoeDove 上面几位大哥的话没怎么听明白,请问一下是只要把c-ares更新就好了嘛?他们说的option参数实在config.json里边改的还是哪里?

我make & make install 了上面这个1.13.0
重启了ss,使用3.10延迟依然存在。
然后迫于无奈更换回去使用旧版

那试试 c-ares master 分支最新...

呃,实在搞不定,最后重新回到了shadowsocks-libev 3.08版

@chunh 阿里云的resolvconf配置 加了一行这个参数:options timeout:1 attempts:1 rotate 引发了这个bug,可以按照下面步骤消除:
修改 /etc/resolvconf/resolv.conf.d 文件,注释掉option那一行:
#options timeout:1 attempts:1 rotate
建议同时将阿里的DNS换成google的:

nameserver 100.100.2.138
nameserver 100.100.2.136

改成:

nameserver 8.8.8.8
nameserver 8.8.4.4

最后重启

@cokebar 问题解决了,非常感谢!

Linode Ubuntu 16.04 LTS 的默认配置下也会出现这个问题

````
$ cat /etc/resolv.conf

Generated by Linode Network Helper

#

This file is automatically generated on each boot with your Linode's

current network configuration. If you need to modify this file, please

first disable the 'Auto-configure Networking' setting within your Linode's

configuration profile:

- https://manager.linode.com/linodes/config/linode**

#

For more information on Network Helper:

- https://www.linode.com/docs/platform/network-helper

#

A backup of the previous config is at /etc/.resolv.conf.linode-last

A backup of the original config is at /etc/.resolv.conf.linode-orig

#
domain members.linode.com
search members.linode.com
nameserver 139.162.68.5
nameserver 139.162.69.5
nameserver 139.162.70.5
nameserver 139.162.71.5
nameserver 139.162.72.5
nameserver 139.162.73.5
nameserver 139.162.74.5
nameserver 139.162.75.5
nameserver 139.162.66.5
nameserver 139.162.67.5
options rotate
````

现象为首次访问网站(解析DNS)过程极其缓慢,建立连接后访问正常。
注释 options rotate 行后恢复正常。

3.1.2 ns 改为8888依然无法识别..
但能ping 通 openapi.alipay.com

Was this page helpful?
0 / 5 - 0 ratings