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.
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)
Solutions
- Check the configured DNS server IPs are valid and reachable for the socket family used (verify with check_ip_valid4 routing in the code)
- Test outbound UDP 53: 'dig @8.8.8.8 example.com' from the same host
- Open/allow outbound UDP 53 in the local firewall or VPN split-tunnel config
- 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
- Pre-check DNS server reachability before sending: try a cheap UDP probe or keep a health flag per server
- Maintain multiple upstream servers and rotate on send failure
- In restrictive environments use DoH on 443 instead of UDP 53
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
- received response without question
- Servers could not be resolved, %r.
- DoH request no name
- query_dns_from_xxnet fail status:%d, cost=%f
- query_dns_from_xxnet %s json:%s parse fail:%s
AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27).
Data as JSON: /api/errors/cc36096484d8e07e.
Report an issue: GitHub.