1.14.4和1.14.5,客户端间歇性出现DNS响应超时重试,可能与1.14引入的TCP DNS连接复用有关

Aperta
#4,748 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go

Direzione di ricerca

Start by reproducing the reported intermittent timeout with the supplied configuration and dig command, then trace TCP DNS connection reuse introduced in version 1.14. Compare behavior with 1.13.21 and inspect the DNS exchange logs around the five-second retry. Done when repeated queries through the TCP DNS server no longer intermittently time out.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

操作系统

Linux

系统版本
安装类型

sing-box 原始命令行程序

如果您使用图形客户端程序,请提供该程序版本。

No response

版本

1.14.5

描述
代理环境:

SS2022节点,DNS:TCP 8.8.8.8

具体表现

由1.13.21升级至1.14.4或1.14.5后,客户端间歇性出现DNS响应超时的问题,但sing-box日志没有输出任何错误。

最初在openwrt上遇到,今天随手写了一个配置在mac上尝试复现成功。

例如打开一个网页,会先卡几秒,然后才能正常加载。

请关注日志中最后两次DNS查询,使用dig命令测试时复现,触发了一次超时5秒重试,然后立即响应成功。

dig @127.0.0.1 -p 35558 test.example.com +time=5 +tries=3

1.14.5中的多项和DNS有关的修改似乎都没有解决此问题。

降级回1.13.21后该问题不再复现。

借助AI分析

Antigravity和Codex均怀疑该问题可能与1.14引入的TCP DNS连接复用有关。

重现方式
{
  "log": {
    "level": "debug"
  },
  "dns": {
    "servers": [
      {
        "tag": "direct",
        "type": "udp",
        "server": "223.5.5.5"
      },
      {
        "tag": "remote",
        "type": "tcp",
        "detour": "ss2022",
        "server": "8.8.8.8",
        "server_port": 53
      }
    ],
    "final": "remote",
    "disable_cache": true
  },
  "inbounds": [
    {
      "type": "direct",
      "tag": "dns-in",
      "listen": "127.0.0.1",
      "listen_port": 35558
    }
  ],
  "outbounds": [
    {
      "type": "shadowsocks",
      "tag": "ss2022",
      "server": "x.x.x.x",
      "server_port": 32599,
      "method": "2022-blake3-aes-128-gcm",
      "password": "xxxx",
      "domain_resolver": {
        "server": "direct"
      }
    },
    {
      "type": "direct",
      "tag": "direct"
    }
  ],
  "route": {
    "default_domain_resolver": "direct",
    "rules": [
      {
        "inbound": "dns-in",
        "action": "hijack-dns"
      }
    ]
  }
}
日志
INFO[0000] inbound/direct[dns-in]: tcp server started at 127.0.0.1:35558
INFO[0000] inbound/direct[dns-in]: udp server started at 127.0.0.1:35558
INFO[0000] network: updated default interface en0, index 14
INFO[0000] network: updated network environment: gateway 192.168.1.1, gateway_mac xx:xx:xx:xx:xx:xx
INFO[0000] sing-box started (0.00s)
INFO[0004] [1260219893 0ms] inbound/direct[dns-in]: inbound packet connection from 127.0.0.1:52650
INFO[0004] [1260219893 0ms] inbound/direct[dns-in]: inbound packet connection to 127.0.0.1:35558
DEBUG[0004] [1260219893 0ms] router: match[0] inbound=dns-in => hijack-dns
DEBUG[0004] [1260219893 0ms] dns: exchange test.example.com. IN A
INFO[0004] [1260219893 0ms] outbound/shadowsocks[ss2022]: outbound connection to 8.8.8.8:53
INFO[0004] [1260219893 0ms] outbound/shadowsocks[ss2022]: outbound connection to 8.8.8.8:53
DEBUG[0005] [1260219893 710ms] dns: exchanged test.example.com NOERROR 67
INFO[0005] [1260219893 710ms] dns: exchanged SOA example.com. 67 IN SOA elliott.ns.cloudflare.com. dns.cloudflare.com. 2421050422 10000 2400 604800 1800
INFO[0005] [1260219893 710ms] dns: exchanged OPT OPT PSEUDOSECTION: EDNS: version 0 flags: udp: 512
INFO[0040] [3720304220 0ms] inbound/direct[dns-in]: inbound packet connection from 127.0.0.1:56685
INFO[0040] [3720304220 0ms] inbound/direct[dns-in]: inbound packet connection to 127.0.0.1:35558
DEBUG[0040] [3720304220 0ms] router: match[0] inbound=dns-in => hijack-dns
DEBUG[0040] [3720304220 0ms] dns: exchange test.example.com. IN A
INFO[0040] [3720304220 0ms] outbound/shadowsocks[ss2022]: outbound connection to 8.8.8.8:53
DEBUG[0041] [3720304220 657ms] dns: exchanged test.example.com NOERROR 31
INFO[0041] [3720304220 658ms] dns: exchanged SOA example.com. 31 IN SOA elliott.ns.cloudflare.com. dns.cloudflare.com. 2421050422 10000 2400 604800 1800
INFO[0041] [3720304220 658ms] dns: exchanged OPT OPT PSEUDOSECTION: EDNS: version 0 flags: udp: 512
INFO[0051] [2977738285 0ms] inbound/direct[dns-in]: inbound packet connection from 127.0.0.1:57561
INFO[0051] [2977738285 0ms] inbound/direct[dns-in]: inbound packet connection to 127.0.0.1:35558
DEBUG[0051] [2977738285 0ms] router: match[0] inbound=dns-in => hijack-dns
DEBUG[0051] [2977738285 0ms] dns: exchange test.example.com. IN A
DEBUG[0051] [2977738285 308ms] dns: exchanged test.example.com NOERROR 21
INFO[0051] [2977738285 308ms] dns: exchanged SOA example.com. 21 IN SOA elliott.ns.cloudflare.com. dns.cloudflare.com. 2421050422 10000 2400 604800 1800
INFO[0051] [2977738285 308ms] dns: exchanged OPT OPT PSEUDOSECTION: EDNS: version 0 flags: udp: 512
INFO[0058] [2749053394 0ms] inbound/direct[dns-in]: inbound packet connection from 127.0.0.1:54540
INFO[0058] [2749053394 0ms] inbound/direct[dns-in]: inbound packet connection to 127.0.0.1:35558
DEBUG[0058] [2749053394 0ms] router: match[0] inbound=dns-in => hijack-dns
DEBUG[0058] [2749053394 0ms] dns: exchange test.example.com. IN A
DEBUG[0059] [2749053394 309ms] dns: exchanged test.example.com NOERROR 13
INFO[0059] [2749053394 309ms] dns: exchanged SOA example.com. 13 IN SOA elliott.ns.cloudflare.com. dns.cloudflare.com. 2421050422 10000 2400 604800 1800
INFO[0059] [2749053394 309ms] dns: exchanged OPT OPT PSEUDOSECTION: EDNS: version 0 flags: udp: 512
INFO[0081] [3920153495 0ms] inbound/direct[dns-in]: inbound packet connection from 127.0.0.1:50186
INFO[0081] [3920153495 0ms] inbound/direct[dns-in]: inbound packet connection to 127.0.0.1:35558
DEBUG[0081] [3920153495 0ms] router: match[0] inbound=dns-in => hijack-dns
DEBUG[0081] [3920153495 0ms] dns: exchange test.example.com. IN A
DEBUG[0086] [3920153495 5.0s] dns: exchange test.example.com. IN A
INFO[0091] [984006073 0ms] inbound/direct[dns-in]: inbound packet connection from 127.0.0.1:50186
INFO[0091] [984006073 0ms] inbound/direct[dns-in]: inbound packet connection to 127.0.0.1:35558
DEBUG[0091] [984006073 0ms] router: match[0] inbound=dns-in => hijack-dns
DEBUG[0091] [984006073 0ms] dns: exchange test.example.com. IN A
INFO[0091] [984006073 0ms] outbound/shadowsocks[ss2022]: outbound connection to 8.8.8.8:53
DEBUG[0092] [984006073 840ms] dns: exchanged test.example.com NOERROR 1799
INFO[0092] [984006073 840ms] dns: exchanged SOA example.com. 1799 IN SOA elliott.ns.cloudflare.com. dns.cloudflare.com. 2421050422 10000 2400 604800 1800
INFO[0092] [984006073 840ms] dns: exchanged OPT OPT PSEUDOSECTION: EDNS: version 0 flags: udp: 512
支持我们
完整性要求
  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我保证提供了可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件。
  • 我保证提供了可用于重现我报告的错误的最简配置,而不是依赖远程服务器、TUN、图形界面客户端或者其他闭源软件。
  • 我保证提供了完整的配置文件与日志,而不是出于对自身智力的自信而仅提供了部分认为有用的部分。
Lingua principale
Go
Stelle
40.4k
Fork
5k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SagerNet/sing-box

Tutte le issue di SagerNet/sing-box

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.