pymumu / smartdns

A local DNS server to obtain the fastest website IP for the best Internet experience, support DoT, DoH. 一个本地DNS服务器,获取最快的网站IP,获得最佳上网体验,支持DoH,DoT。
https://pymumu.github.io/smartdns/
GNU General Public License v3.0
8.46k stars 1.08k forks source link

疑似prefetch-domain yes 导致不定时退出 #86

Closed rufengsuixing closed 5 years ago

rufengsuixing commented 5 years ago

问题现象
运行的好好的突然退出

运行环境

  1. 固件型号
    老毛子
  2. 运营商
    移动 重现步骤
  3. 上游DNS配置。
    server-name smartdns bind [::]:8053 cache-size 512 prefetch-domain yes dualstack-ip-selection yes log-level error log-file /tmp/syslog.log audit-file /tmp/syslog.log

    localdns

    server 211.141.0.99

    dns1.apcix.com.cn

    server 211.157.15.189

    bj.chinamobile

    server 221.130.33.52

    sinapore

    server 210.80.58.3

    hk

    server 202.130.97.65

    us

    server 156.154.70.1

    JP

    server 203.112.2.5

    hanguo

    server 218.232.110.36

    famous

    server 119.29.29.29 server 114.114.114.114 server 223.5.5.5

conf-file /tmp/ss/dnsmasq.d/r.wantoss.conf conf-file /tmp/ss/dnsmasq.d/r.gfwlist.conf conf-file /tmp/ss/dnsmasq.d/r.sub.conf conf-file /opt/etc/smartdns/adblock.conf conf-file /opt/etc/smartdns/mylist.conf

  1. 访问的域名。
    不知道 应该是开启了prefetch-domain yes 后出现的,之前很稳定 信息收集
    [2019-02-11 10:32:44,860][ERROR][ smartdns.c:317 ] process exit with signa l 11, code = 1, errno = 0, pid = 12, self = 354, pc = 0x40cca8, addr = 0xc, buil d(Jan 26 2019 00:14:48)

[2019-02-11 13:20:11,154][ERROR][ smartdns.c:317 ] process exit with signa l 11, code = 1, errno = 0, pid = 12, self = 10111, pc = 0x40cca8, addr = 0xc, bu ild(Jan 26 2019 00:14:48)

[2019-02-11 14:07:03,217][ERROR][ smartdns.c:317 ] process exit with signa l 11, code = 1, errno = 0, pid = 12, self = 12005, pc = 0x40cca8, addr = 0xc, bu ild(Jan 26 2019 00:14:48)

[2019-02-11 14:52:03,864][ERROR][ smartdns.c:317 ] process exit with signa l 11, code = 1, errno = 0, pid = 12, self = 21680, pc = 0x40cca8, addr = 0xc, bu ild(Jan 26 2019 00:14:48)

[2019-02-11 15:12:07,510][ERROR][ smartdns.c:317 ] process exit with signa l 11, code = 1, errno = 0, pid = 12, self = 31085, pc = 0x40cca8, addr = 0xc, bu ild(Jan 26 2019 00:14:48)

[2019-02-11 16:02:05,464][ERROR][ smartdns.c:317 ] process exit with signa l 11, code = 1, errno = 0, pid = 12, self = 3046, pc = 0x40cca8, addr = 0xc, bui ld(Jan 26 2019 00:14:48)

[2019-02-11 16:52:51,300][ERROR][ smartdns.c:317 ] process exit with signa l 11, code = 1, errno = 0, pid = 12, self = 13410, pc = 0x40cca8, addr = 0xc, bu ild(Jan 26 2019 00:14:48)

pymumu commented 5 years ago

哪个安装文件,我最近优化过代码,给你个版本在验证下。

是不是这个:

smartdns.1.2019.02.11-1132.mipsel-3.4.ipk.zip

rufengsuixing commented 5 years ago

正在测试,暂时没再出现

rufengsuixing commented 5 years ago

最新版还是出现了 2019-02-12 06:47:47,584][ERROR][ smartdns.c:319 ] process exit with signal 11, code = 1, errno = 0, pid = 12, self = 16820, pc = 0x41585c, addr = 0xc, build(Feb 11 2019 11:33:15) Feb 12 06:47:53 【smartdns】: 重新启动0

rufengsuixing commented 5 years ago

到现在没有再出现异常退出

rufengsuixing commented 5 years ago

2019-02-12 16:01:59,480][ERROR][ smartdns.c:319 ] process exit with signal 11, code = 1, errno = 0, pid = 12, self = 27880, pc = 0x41585c, addr = 0xc, build(Feb 11 2019 11:33:15) 看来要加上–s选项了 新的2-11还不错,在prefetch下,不会出现ipset规则失效了

pymumu commented 5 years ago

在试一下这个版本,规避了一下异常。应该不会crash了,但关注一下功能有没有一异常

smartdns.1.2019.02.13-0022.mipsel-3.4.ipk.zip

rufengsuixing commented 5 years ago

已经用了新版本 配置添加部分 rr-ttl-min 300

conf-file /opt/etc/smartdns/adblock.conf

conf-file /opt/etc/smartdns/mylist.conf

programaddconfig

conf-file /tmp/ss/dnsmasq.d/cflist.conf.smd conf-file /tmp/ss/dnsmasq.d/r.gfwlist.conf.smd conf-file /tmp/ss/dnsmasq.d/r.wantoss.conf.smd conf-file /tmp/ss/dnsmasq.d/cflist.conf.smd conf-file /tmp/adbyby_host.conf.smd 出现日志 运行一晚上没有任何清空ipset的操作 2019-02-14 06:07:33,778][ERROR][ dns_server.c:385 ] client is invalid, domain: docs.google.com [2019-02-14 06:09:19,778][ERROR][ dns_server.c:385 ] client is invalid, domain: www.google.com

router /tmp/ss/dnsmasq.d]# grep -R google.com *.smd cflist.conf.smd:ipset /.google.com/cflist 省略部分 r.gfwlist.conf.smd:ipset /.google.com.hk/gfwlist

[router /tmp/ss/dnsmasq.d]# dig www.google.com @127.0.0.1 -p 8053

; <<>> DiG 9.11.5 <<>> www.google.com @127.0.0.1 -p 8053 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41087 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;www.google.com. IN A

;; ANSWER SECTION: www.google.com. 69 IN A 69.171.244.15(应该进cflist)

;; Query time: 0 msec ;; SERVER: 127.0.0.1#8053(127.0.0.1) ;; WHEN: Wed Feb 13 22:13:10 UTC 2019 ;; MSG SIZE rcvd: 62

[router /tmp/ss/dnsmasq.d]# dig google.com @127.0.0.1 -p 8053

; <<>> DiG 9.11.5 <<>> google.com @127.0.0.1 -p 8053 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6717 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;google.com. IN A

;; ANSWER SECTION: google.com. 300 IN A 216.58.197.110

;; Query time: 930 msec ;; SERVER: 127.0.0.1#8053(127.0.0.1) ;; WHEN: Wed Feb 13 22:13:18 UTC 2019 ;; MSG SIZE rcvd: 54

[router /tmp/ss/dnsmasq.d]# ipset list cflist Name: cflist Type: hash:ip Revision: 4 Header: family inet hashsize 1024 maxelem 65536 Size in memory: 100 References: 2 Number of entries: 1 Members: 216.58.197.110 (只有一个,没有www.google.com域名) [router /tmp/ss/dnsmasq.d]# dig www.google.com @127.0.0.1 -p 8053

; <<>> DiG 9.11.5 <<>> www.google.com @127.0.0.1 -p 8053 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61299 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;www.google.com. IN A

;; ANSWER SECTION: www.google.com. 32 IN A 69.171.244.15

;; Query time: 0 msec ;; SERVER: 127.0.0.1#8053(127.0.0.1) ;; WHEN: Wed Feb 13 22:13:47 UTC 2019 ;; MSG SIZE rcvd: 62

[router /tmp/ss/dnsmasq.d]# ipset list cflist Name: cflist Type: hash:ip Revision: 4 Header: family inet hashsize 1024 maxelem 65536 Size in memory: 100 References: 2 Number of entries: 1 Members: 216.58.197.110 [router /tmp/ss/dnsmasq.d]# dig www.google.com.hk @127.0.0.1 -p 8053

; <<>> DiG 9.11.5 <<>> www.google.com.hk @127.0.0.1 -p 8053 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33712 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;www.google.com.hk. IN A

;; ANSWER SECTION: www.google.com.hk. 300 IN A 75.126.215.88

;; Query time: 336 msec ;; SERVER: 127.0.0.1#8053(127.0.0.1) ;; WHEN: Wed Feb 13 22:15:37 UTC 2019 ;; MSG SIZE rcvd: 68

[router /tmp/ss/dnsmasq.d]# ipset list gfwlist Name: gfwlist Type: hash:ip Revision: 4 Header: family inet hashsize 1024 maxelem 65536 Size in memory: 220 References: 1 Number of entries: 4 Members: 75.126.215.88 98.136.144.143 203.208.40.39 172.217.31.238

rufengsuixing commented 5 years ago

client is invalid 影响了加入ipset的操作,因为我这里ttl是300,就会导致300s加不入list

pymumu commented 5 years ago

是开启了prefetch功能了吧

rufengsuixing commented 5 years ago

是的开启了

pymumu commented 5 years ago

修改了一下,prefetch有分支未处理。

另外增加了ipset-timeout yes配置,支持ipset超时 但要注意,创建ipset的时候,需要设置启用timeout功能 如:

ipset add foo hash:ip timeout 0

smartdns.1.2019.02.15-0012.mipsel-3.4.ipk.zip