XX-net/XX-Net · warning

send_request except:%r

Error message

send_request except:%r

What it means

send_request() failed to send a UDP DNS query packet to the upstream server. This is a socket sendto() failure — typically ICMP port unreachable, network unreachable, invalid address family, or the socket not being connected/bound. The query is dropped and the caller's waiter eventually times out.

Solutions

  1. Check the configured DNS server IPs are valid and reachable for the socket family used (verify with check_ip_valid4 routing in the code)
  2. Test outbound UDP 53: 'dig @8.8.8.8 example.com' from the same host
  3. Open/allow outbound UDP 53 in the local firewall or VPN split-tunnel config
  4. Fall back to TCP/TLS/HTTPS DNS transports (this module's TCP, DoT, DoH query classes) since port 53 UDP is commonly blocked
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: sendto() to (server_ip, 53) raising because the DNS server IP is unreachable, an IPv6 address being passed to the IPv4 socket (or vice versa), the network interface being down, or a local firewall rejecting outbound UDP 53.

Common situations: Firewalled outbound port 53 (common in corporate networks forcing internal DNS), wrong IP family in the DNS config, VPN routing breaking UDP, transient network loss.

Related errors


AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27). Data as JSON: /api/errors/cc36096484d8e07e. Report an issue: GitHub.

Appendix: source

Thrown at code/default/smart_router/local/dns_query.py:270

                    que.put(ips)
            except Exception as e:
                xlog.exception("dns recv_worker except:%r", e)

        xlog.info("DNS Client recv worker exit.")
        sock.close()

    def send_request(self, id, server_ip, domain, dns_type):
        try:
            d = DNSRecord(DNSHeader(id))
            d.add_question(DNSQuestion(domain, dns_type))
            req4_pack = d.pack()

            if utils.check_ip_valid4(server_ip):
                self.sock.sendto(req4_pack, (server_ip, 53))
            else:
                self.sock6.sendto(req4_pack, (server_ip, 53))
        except Exception as e:
            xlog.warn("send_request except:%r", e)

    def query_by_system(self, domain, dns_type):
        ips = []
        try:
            t0 = time.time()
            ip = socket.gethostbyname(domain)
            t1 = time.time()
            ips.append(ip)

            xlog.debug("query_by_system, %s %d cost:%f, return:%s", domain, dns_type, t1 - t0, ips)
        except Exception as e:
            xlog.warn("query_by_system %s %d e:%r", domain, dns_type, e)

        return ips

    def query(self, domain, dns_type=1, timeout=3):
        if sys.platform == "ios":
            return self.query_by_system(domain, dns_type)

View on GitHub (pinned to cfa5bc17b6)