IrineSistiana / mosdns

一个 DNS 转发器
GNU General Public License v3.0
2.97k stars 339 forks source link

[Bug] 用内网dns时mosdns报context deadline exceeded错误,无法解决 #843

Open gtxy22 opened 1 month ago

gtxy22 commented 1 month ago

在提交之前,请确认

mosdns 版本

v5.3.3

操作系统

IstoreOS

Bug 描述和复现步骤

mosdns显示超时返回SERVFAIL但是AdGuardhome 中无任何异常,皆为0.0 毫秒的返回。某段如图所示 image 且99%日志皆为上图所示(已确认)。 网络环境 移动,无论forward_local是用host的127.0.0.1还是用docker 172.0.0.都无改善。但是在指定外网dns(22.3.5.5.5)之后问题就不会这么多了。CPU型号为3865u image 此为CPU占用图 可复现,但不确定是不是CPU的问题,似乎观察CPU并没有沾满,想问这个问题是不是bug。或者能够有什么途径解决求大佬指教 docker AGH + luci mosdns ,配置文件修改处贴在了下方

使用的配置文件

openwrt luci 图形化界面修改某些数据
自定义国内 DNS 打开
127.0.0.1:2334(docker安装的AGH)
远程 DNS 服务器 打开
127.0.0.1:2222(openclash)
防止 DNS 泄漏 开启

mosdns 的 log 记录

2024-09-20 12:53:03 WARN    forward_local   upstream error  {"uqid": 1033, "qname": "lf-zt.douyin.com.", "qclass": 1, "qtype": 1, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:53:03 WARN    udp_server  entry err   {"query": {"uqid": 1033, "client": "::ffff:127.0.0.1", "qname": "lf-zt.douyin.com.", "qtype": 1, "qclass": 1, "elapsed": "5.001190457s"}, "error": "context deadline exceeded"}
2024-09-20 12:53:03 WARN    forward_local   upstream error  {"uqid": 1036, "qname": "h5vv6.video.qq.com.", "qclass": 1, "qtype": 1, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:53:03 WARN    udp_server  entry err   {"query": {"uqid": 1036, "client": "::ffff:127.0.0.1", "qname": "h5vv6.video.qq.com.", "qtype": 1, "qclass": 1, "elapsed": "5.000907379s"}, "error": "all upstream servers failed"}
2024-09-20 12:53:03 WARN    udp_server  entry err   {"query": {"uqid": 1035, "client": "::ffff:127.0.0.1", "qname": "h5vv6.video.qq.com.", "qtype": 28, "qclass": 1, "elapsed": "5.001177118s"}, "error": "context deadline exceeded"}
2024-09-20 12:53:03 WARN    forward_local   upstream error  {"uqid": 1035, "qname": "h5vv6.video.qq.com.", "qclass": 1, "qtype": 28, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:53:05 WARN    udp_server  entry err   {"query": {"uqid": 1061, "client": "::ffff:127.0.0.1", "qname": "sso.douyin.com.", "qtype": 1, "qclass": 1, "elapsed": "5.000673128s"}, "error": "context deadline exceeded"}
2024-09-20 12:53:05 WARN    forward_local   upstream error  {"uqid": 1061, "qname": "sso.douyin.com.", "qclass": 1, "qtype": 1, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:53:05 WARN    forward_local   upstream error  {"uqid": 1064, "qname": "imapi.douyin.com.", "qclass": 1, "qtype": 28, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:53:05 WARN    udp_server  entry err   {"query": {"uqid": 1064, "client": "::ffff:127.0.0.1", "qname": "imapi.douyin.com.", "qtype": 28, "qclass": 1, "elapsed": "5.001132046s"}, "error": "all upstream servers failed"}
2024-09-20 12:53:06 WARN    udp_server  entry err   {"query": {"uqid": 1067, "client": "::ffff:127.0.0.1", "qname": "res.ab.qq.com.", "qtype": 28, "qclass": 1, "elapsed": "5.000142205s"}, "error": "context deadline exceeded"}
2024-09-20 12:53:06 WARN    forward_local   upstream error  {"uqid": 1067, "qname": "res.ab.qq.com.", "qclass": 1, "qtype": 28, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:53:08 WARN    udp_server  entry err   {"query": {"uqid": 1073, "client": "::ffff:127.0.0.1", "qname": "lf-zt.douyin.com.", "qtype": 1, "qclass": 1, "elapsed": "5.000532075s"}, "error": "context deadline exceeded"}
2024-09-20 12:53:08 WARN    forward_local   upstream error  {"uqid": 1073, "qname": "lf-zt.douyin.com.", "qclass": 1, "qtype": 1, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:53:10 WARN    forward_local   upstream error  {"uqid": 1077, "qname": "sso.douyin.com.", "qclass": 1, "qtype": 1, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:53:10 WARN    udp_server  entry err   {"query": {"uqid": 1077, "client": "::ffff:127.0.0.1", "qname": "sso.douyin.com.", "qtype": 1, "qclass": 1, "elapsed": "5.001234374s"}, "error": "all upstream servers failed"}
2024-09-20 12:53:11 WARN    forward_local   upstream error  {"uqid": 1086, "qname": "v3-web.douyinvod.com.", "qclass": 1, "qtype": 1, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:53:11 WARN    udp_server  entry err   {"query": {"uqid": 1086, "client": "::ffff:127.0.0.1", "qname": "v3-web.douyinvod.com.", "qtype": 1, "qclass": 1, "elapsed": "5.004046002s"}, "error": "all upstream servers failed"}
2024-09-20 12:53:13 WARN    forward_local   upstream error  {"uqid": 1116, "qname": "music.163.com.", "qclass": 1, "qtype": 1, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:53:13 WARN    udp_server  entry err   {"query": {"uqid": 1116, "client": "::ffff:127.0.0.1", "qname": "music.163.com.", "qtype": 1, "qclass": 1, "elapsed": "5.00063606s"}, "error": "all upstream servers failed"}
2024-09-20 12:53:13 WARN    forward_local   upstream error  {"uqid": 1118, "qname": "webrtcice.video.qq.com.", "qclass": 1, "qtype": 28, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:53:13 WARN    udp_server  entry err   {"query": {"uqid": 1118, "client": "::ffff:127.0.0.1", "qname": "webrtcice.video.qq.com.", "qtype": 28, "qclass": 1, "elapsed": "5.001076413s"}, "error": "all upstream servers failed"}
2024-09-20 12:53:36 WARN    forward_local   upstream error  {"uqid": 1167, "qname": "webrtcice.video.qq.com.", "qclass": 1, "qtype": 28, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:53:36 WARN    udp_server  entry err   {"query": {"uqid": 1167, "client": "::ffff:127.0.0.1", "qname": "webrtcice.video.qq.com.", "qtype": 28, "qclass": 1, "elapsed": "5.002035749s"}, "error": "all upstream servers failed"}
2024-09-20 12:53:57 WARN    udp_server  entry err   {"query": {"uqid": 1198, "client": "::ffff:127.0.0.1", "qname": "api.codelife.cc.", "qtype": 1, "qclass": 1, "elapsed": "5.000853641s"}, "error": "context deadline exceeded"}
2024-09-20 12:53:57 WARN    forward_local   upstream error  {"uqid": 1198, "qname": "api.codelife.cc.", "qclass": 1, "qtype": 1, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:54:28 WARN    forward_local   upstream error  {"uqid": 1269, "qname": "webrtcice.video.qq.com.", "qclass": 1, "qtype": 28, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:54:28 WARN    udp_server  entry err   {"query": {"uqid": 1269, "client": "::ffff:127.0.0.1", "qname": "webrtcice.video.qq.com.", "qtype": 28, "qclass": 1, "elapsed": "5.002052516s"}, "error": "all upstream servers failed"}
2024-09-20 12:54:33 WARN    forward_local   upstream error  {"uqid": 1274, "qname": "webrtcice.video.qq.com.", "qclass": 1, "qtype": 28, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:54:33 WARN    udp_server  entry err   {"query": {"uqid": 1274, "client": "::ffff:127.0.0.1", "qname": "webrtcice.video.qq.com.", "qtype": 28, "qclass": 1, "elapsed": "5.00104815s"}, "error": "all upstream servers failed"}
2024-09-20 12:54:38 WARN    forward_local   upstream error  {"uqid": 1280, "qname": "webrtcice.video.qq.com.", "qclass": 1, "qtype": 28, "upstream": "172.18.0.1:2334", "error": "context deadline exceeded"}
2024-09-20 12:54:38 WARN    udp_server  entry err   {"query": {"uqid": 1280, "client": "::ffff:127.0.0.1", "qname": "webrtcice.video.qq.com.", "qtype": 28, "qclass": 1, "elapsed": "5.002579772s"}, "error": "all upstream servers failed"}
2024-09-20 12:54:41 WARN    udp_server  entry err   {"query": {"uqid": 1296, "client": "::ffff:127.0.0.1", "qname": "i0.hdslb.com.", "qtype": 1, "qclass": 1, "elapsed": "5.00010171s"}, "error": "context deadline exceeded"}
gtxy22 commented 1 month ago

下面是使用外网dns的日志,上面是使用内网dns且把加载过程省略的mosdns日志

2024-09-20 13:12:46 INFO    unpacking entry {"tag": "cn", "length": 18354, "file": "/var/mosdns/geoip_cn.txt"}
2024-09-20 13:12:46 INFO    unpacking entry {"tag": "cn", "length": 90143, "file": "/var/mosdns/geosite_cn.txt"}
2024-09-20 13:12:46 INFO    unpacking entry {"tag": "apple", "length": 1771, "file": "/var/mosdns/geosite_apple.txt"}
2024-09-20 13:12:46 INFO    unpacking entry {"tag": "geolocation-!cn", "length": 25380, "file": "/var/mosdns/geosite_geolocation-!cn.txt"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "geosite_cn", "type": "domain_set"}
2024-09-20 13:12:46 INFO    starting api http server    {"addr": "0.0.0.0:9091"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "geoip_cn", "type": "ip_set"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "geosite_apple", "type": "domain_set"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "geosite_no_cn", "type": "domain_set"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "whitelist", "type": "domain_set"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "blocklist", "type": "domain_set"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "greylist", "type": "domain_set"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "ddnslist", "type": "domain_set"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "hosts", "type": "hosts"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "redirect", "type": "redirect"}
2024-09-20 13:12:46 INFO    redirect    redirect rules loaded   {"length": 0}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "adlist", "type": "domain_set"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "local_ptr", "type": "domain_set"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "stream_media", "type": "domain_set"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "cloudflare_cidr", "type": "ip_set"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "forward_xinfeng_udp", "type": "forward"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "forward_local", "type": "forward"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "forward_remote", "type": "forward"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "forward_remote_upstream", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "forward_stream_media", "type": "forward"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "forward_stream_media_upstream", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "modify_ttl", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "modify_ddns_ttl", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "has_resp_sequence", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "query_is_non_local_ip", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "fallback", "type": "fallback"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "apple_domain_fallback", "type": "fallback"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "query_is_apple_domain", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "query_is_ddns_domain", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "query_is_local_domain", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "query_is_no_local_domain", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "query_is_whitelist_domain", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "query_is_greylist_domain", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "query_is_reject_domain", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "query_is_stream_media_domain", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "main_sequence", "type": "sequence"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "udp_server", "type": "udp_server"}
2024-09-20 13:12:46 INFO    udp_server  udp server started  {"addr": "[::]:2023"}
2024-09-20 13:12:46 INFO    loading plugin  {"tag": "tcp_server", "type": "tcp_server"}
2024-09-20 13:12:46 INFO    tcp_server  tcp server started  {"addr": "[::]:2023", "tls": false}
2024-09-20 13:12:46 INFO    all plugins are loaded
2024-09-20 13:13:19 WARN    forward_remote  upstream error  {"uqid": 350, "qname": "edge.microsoft.com.", "qclass": 1, "qtype": 28, "upstream": "127.0.0.1:2222", "error": "context deadline exceeded"}
2024-09-20 13:13:19 WARN    udp_server  entry err   {"query": {"uqid": 350, "client": "::ffff:127.0.0.1", "qname": "edge.microsoft.com.", "qtype": 28, "qclass": 1, "elapsed": "5.000729601s"}, "error": "context deadline exceeded"}
2024-09-20 13:14:04 WARN    fallback    primary error   {"query": {"uqid": 372, "client": "::ffff:127.0.0.1", "qname": "o1098464.ingest.sentry.io.", "qtype": 1, "qclass": 1, "elapsed": "5.001114747s"}, "error": "context deadline exceeded"}
2024-09-20 13:14:04 WARN    udp_server  entry err   {"query": {"uqid": 372, "client": "::ffff:127.0.0.1", "qname": "o1098464.ingest.sentry.io.", "qtype": 1, "qclass": 1, "elapsed": "5.001122064s"}, "error": "context deadline exceeded"}
2024-09-20 13:14:04 WARN    fallback    secondary error {"query": {"uqid": 372, "client": "::ffff:127.0.0.1", "qname": "o1098464.ingest.sentry.io.", "qtype": 1, "qclass": 1, "elapsed": "5.001160826s"}, "error": "context deadline exceeded"}
2024-09-20 13:14:04 WARN    forward_remote  upstream error  {"uqid": 372, "qname": "o1098464.ingest.sentry.io.", "qclass": 1, "qtype": 1, "upstream": "127.0.0.1:2222", "error": "context deadline exceeded"}
2024-09-20 13:14:04 WARN    forward_remote  upstream error  {"uqid": 372, "qname": "o1098464.ingest.sentry.io.", "qclass": 1, "qtype": 1, "upstream": "127.0.0.1:2222", "error": "context deadline exceeded"}
2024-09-20 13:15:27 WARN    forward_remote  upstream error  {"uqid": 421, "qname": "pool.ntp.org.", "qclass": 1, "qtype": 28, "upstream": "127.0.0.1:2222", "error": "context deadline exceeded"}
2024-09-20 13:15:27 WARN    udp_server  entry err   {"query": {"uqid": 421, "client": "::ffff:127.0.0.1", "qname": "pool.ntp.org.", "qtype": 28, "qclass": 1, "elapsed": "5.002310579s"}, "error": "context deadline exceeded"}
2024-09-20 13:16:47 WARN    fallback    primary error   {"query": {"uqid": 666, "client": "::ffff:127.0.0.1", "qname": "mo.fish.", "qtype": 1, "qclass": 1, "elapsed": "5.000192697s"}, "error": "context deadline exceeded"}
2024-09-20 13:16:47 WARN    forward_remote  upstream error  {"uqid": 666, "qname": "mo.fish.", "qclass": 1, "qtype": 1, "upstream": "127.0.0.1:2222", "error": "context deadline exceeded"}
gtxy22 commented 1 month ago

在文档中我也没有发现能改超时最大时间的参数,v4出现过但是v5好像没有出现过

yyysuo commented 1 month ago

内网改tcp就行了。