Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sing-box UDP DNS type create mass of UDP sockets that are not released #2541

Open
4 of 5 tasks
ZeroClover opened this issue Feb 4, 2025 · 0 comments
Open
4 of 5 tasks
Labels
bug Something isn't working

Comments

@ZeroClover
Copy link

ZeroClover commented Feb 4, 2025

Operating system

Linux

System version

Debian 13 trixie

Installation type

Original sing-box Command Line

If you are using a graphical client, please provide the version of the client.

No response

Version

sing-box version 1.12.0-alpha.2

Environment: go1.23.5 linux/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api
Revision: 460c5236718b3bab9baf63f32333bae41a6f135e
CGO: disabled

Description

When using UDP DNS server type, sing-box creates numerous UDP sockets and fails to release them, leading to a gradual increase in the number of sockets as sing-box runs until the 5-tuple is exhausted.

This phenomenon does not occur in version 1.11.0.

lsof -i udp:53
sing-box 105611 root 8200u  IPv4 1804714      0t0  UDP localhost:35419->localhost:domain 
sing-box 105611 root 8201u  IPv4 1806459      0t0  UDP localhost:59827->localhost:domain 
sing-box 105611 root 8202u  IPv4 1804719      0t0  UDP localhost:57271->localhost:domain 
sing-box 105611 root 8203u  IPv4 1804720      0t0  UDP localhost:47106->localhost:domain 
sing-box 105611 root 8204u  IPv4 1807387      0t0  UDP localhost:40489->localhost:domain 
sing-box 105611 root 8205u  IPv4 1804878      0t0  UDP localhost:49876->localhost:domain 
sing-box 105611 root 8206u  IPv4 1807388      0t0  UDP localhost:60220->localhost:domain 
sing-box 105611 root 8207u  IPv4 1807697      0t0  UDP localhost:33344->localhost:domain 
sing-box 105611 root 8208u  IPv4 1808948      0t0  UDP localhost:37605->localhost:domain 
sing-box 105611 root 8209u  IPv4 1804734      0t0  UDP localhost:60493->localhost:domain 
sing-box 105611 root 8210u  IPv4 1805923      0t0  UDP localhost:54634->localhost:domain 
sing-box 105611 root 8211u  IPv4 1806172      0t0  UDP localhost:37663->localhost:domain 
sing-box 105611 root 8212u  IPv4 1806683      0t0  UDP localhost:51929->localhost:domain 
sing-box 105611 root 8213u  IPv4 1805959      0t0  UDP localhost:50436->localhost:domain 
sing-box 105611 root 8214u  IPv4 1806511      0t0  UDP localhost:43363->localhost:domain 

Reproduction

{
  "log":{
    "level":"info"
  },
  "dns":{
    "servers": [
      {
        "tag": "dnsproxy",
        "type": "udp",
        "server": "127.0.0.1"
      }
    ]
  },
  "ntp":{
    "enabled":true,
    "server":"time.cloudflare.com",
    "server_port":123,
    "interval":"30m"
  },
  "inbounds":[
    {
      "tag":"ss2022",
      "type":"shadowsocks",
      "listen":"::",
      "listen_port":2022,
      "tcp_multi_path":true,
      "udp_fragment":true,
      "udp_timeout":"5m",
      "method":"2022-blake3-aes-256-gcm",
      "password": "xxxxxxxxxx",
      "users": [
        {
          "name": "zero",
          "password": "xxxxxxxxxx"
        }
      ]
    }
  ],
  "outbounds":[
    {
      "type":"direct",
      "tag": "direct",
      "domain_resolver": "dnsproxy",
      "domain_strategy": "prefer_ipv4"
    }
  ],
  "route": {
      "default_domain_resolver": {
        "server": "dnsproxy"
      },
    "rules": [
      {
        "action": "resolve",
        "strategy": "prefer_ipv4"
      },
      {
        "action": "sniff",
        "timeout": "3s"
      },
      {
        "protocol": "dns",
        "action": "hijack-dns"
      },
      {
        "action": "route",
        "outbound": "direct"
      },
      {
        "action": "route-options",
        "udp_disable_domain_unmapping": true,
        "udp_timeout": "5m"
      }
    ]
  }
}

Logs

Feb 05 02:17:46 sing-box.node sing-box[105611]: INFO[90135] [2955962781 0ms] inbound/shadowsocks[ss2022]: inbound multiplex connection to login.live.com:443
Feb 05 02:17:46 sing-box.node sing-box[105611]: ERROR[90135] [2955962781 7ms] dns: lookup failed for login.live.com: exchange6: dial udp 127.0.0.1:53: connect: resource temporarily unavailable | exchange4: dial udp 127.0.0.1:53: connect: resource temporarily unavailable
Feb 05 02:17:46 sing-box.node sing-box[105611]: INFO[90135] [202936287 0ms] inbound/shadowsocks[ss2022]: inbound multiplex connection to login.live.com:443
Feb 05 02:17:46 sing-box.node sing-box[105611]: ERROR[90135] [202936287 7ms] dns: lookup failed for login.live.com: exchange6: dial udp 127.0.0.1:53: connect: resource temporarily unavailable | exchange4: dial udp 127.0.0.1:53: connect: resource temporarily unavailable
Feb 05 02:17:48 sing-box.node sing-box[105611]: INFO[90137] [1327441837 0ms] inbound/shadowsocks[ss2022]: inbound multiplex connection to login.live.com:443
Feb 05 02:17:48 sing-box.node sing-box[105611]: ERROR[90137] [1327441837 8ms] dns: lookup failed for login.live.com: exchange6: dial udp 127.0.0.1:53: connect: resource temporarily unavailable | exchange4: dial udp 127.0.0.1:53: connect: resource temporarily unavailable
Feb 05 02:17:48 sing-box.node sing-box[105611]: INFO[90137] [72354193 0ms] inbound/shadowsocks[ss2022]: inbound multiplex connection to login.live.com:443
Feb 05 02:17:48 sing-box.node sing-box[105611]: ERROR[90137] [72354193 8ms] dns: lookup failed for login.live.com: exchange6: dial udp 127.0.0.1:53: connect: resource temporarily unavailable | exchange4: dial udp 127.0.0.1:53: connect: resource temporarily unavailable
Feb 05 02:17:50 sing-box.node sing-box[105611]: INFO[90139] [232824877 0ms] inbound/shadowsocks[ss2022]: inbound connection from <REDACTED>:33106
Feb 05 02:17:50 sing-box.node sing-box[105611]: INFO[90139] [232824877 54ms] inbound/shadowsocks[ss2022]: [zero] inbound connection to init.push.apple.com:443
Feb 05 02:17:50 sing-box.node sing-box[105611]: ERROR[90139] [232824877 62ms] dns: lookup failed for init.push.apple.com: exchange6: dial udp 127.0.0.1:53: connect: resource temporarily unavailable | exchange4: dial udp 127.0.0.1:53: connect: resource temporarily unavailable
Feb 05 02:17:50 sing-box.node sing-box[105611]: INFO[90139] [44009752 0ms] inbound/shadowsocks[ss2022]: inbound connection from <REDACTED>:33108
Feb 05 02:17:50 sing-box.node sing-box[105611]: INFO[90139] [44009752 53ms] inbound/shadowsocks[ss2022]: [zero] inbound connection to init.push.apple.com:443
Feb 05 02:17:50 sing-box.node sing-box[105611]: ERROR[90139] [44009752 62ms] dns: lookup failed for init.push.apple.com: exchange6: dial udp 127.0.0.1:53: connect: resource temporarily unavailable | exchange4: dial udp 127.0.0.1:53: connect: resource temporarily unavailable

Supporter

Integrity requirements

  • I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
  • I confirm that I have provided the server and client configuration files and process that can be reproduced locally, instead of a complicated client configuration file that has been stripped of sensitive data.
  • I confirm that I have provided the simplest configuration that can be used to reproduce the error I reported, instead of depending on remote servers, TUN, graphical interface clients, or other closed-source software.
  • I confirm that I have provided the complete configuration files and logs, rather than just providing parts I think are useful out of confidence in my own intelligence.
@ZeroClover ZeroClover changed the title sing-box created tens of thousands of DNS query connections sing-box UDP DNS type create mass of UDP sockets that are not released Feb 4, 2025
@nekohasekai nekohasekai added the bug Something isn't working label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants