daeuniverse / daeuniverse/dae

[Bug Report] DNS 可能出现卡死问题

Closed
#767 8 comments 3 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
6.2k
Forks
403
Avg merge
57m
Merged PRs (30d)
2

Description

### Checks

- [x] I have searched the existing issues
- [x] I have read the documentation
- [ ] Is it your first time sumbitting an issue

### Current Behavior

当dns服务器(如udp://8.8.8.8:53)走代理,查询次数增加过多或者dns berchmark后,dae的dns就会出现以下症状,包括但不限于:
1、国外dns解析速度变慢
2、无法解析节点域名
3、部分域名解析超时
4、相对于dns查询不走代理的情况,解析失败次数有明显增加

### Expected Behavior

当dns走代理后,dns解析正常。不再出现超时或者解析失败的情况。

### Steps to Reproduce

1、dae的dns upsteam写上“tcp+udp://1.1.1.1:53“,并在route增加以下配置: "dip(8.8.8.8) && dport(53)->proxy"
2、在dhcp下方设备运行python脚本(要先把脚本中的‘172.17.17.1’修改为dae地址)
`
#main.py
import socket
import threading
import time
from dnslib import DNSRecord, DNSQuestion, type_A

class DNSTester(threading.Thread):
def __init__(self, domain, num_requests, server_ip):
super().__init__()
self.domain = domain
self.num_requests = num_requests
self.server_ip = server_ip
self.responses = []
self.start_time = None

def run(self):
for _ in range(self.num_requests):
try:
# 构造DNS查询
q = DNSQuestion(self.domain, type_A)
record = DNSRecord.question(q)
packet = bytes(record)
# 发送查询并计算响应时间
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.settimeout(1)
start_time = time.time()
sock.sendto(packet, (self.server_ip, 53))
data = sock.recvfrom()
end_time = time.time()
rtt = end_time - start_time
self.responses.append(rtt)
except Exception as e:
self.responses.append(float('inf')) # 记录为无穷大,表示失败
finally:
if sock:
sock.close()

def get_success_responses(self):
return [rt for rt in self.responses if rt != float('inf')]

def main():
target_domains = ['www.youtube.com', 'www.google.com', 'www.hub.docker.com']
server_ip = '172.17.17.1'

# 获取用户输入
total_requests = int(input("请输入总请求数:"))
threads = int(input("请输入线程数:"))

threads_per_domain = total_requests // len(target_domains)

testers = []
for domain in target_domains:
t = DNSTester(domain, threads_per_domain, server_ip)
testers.append(t)

for t in testers:
t.start()

for t in testers:
t.join()

# 收集所有响应时间
all_responses = []
for t in testers:
all_responses += t.responses

success_count = sum(1 for rt in all_responses if rt != float('inf'))
total_count = len(all_responses)

if total_count == 0:
print("没有响应")
else:
avg_rt = sum(all_responses) / total_count
max_rt = max(all_responses)
min_rt = min(all_responses)

# 计算成功的响应
success_rt_sum = sum(rt for rt in all_responses if rt != float('inf'))
if success_count > 0:
avg_success_rt = success_rt_sum / success_count
else:
avg_success_rt = 0.0
total_rt_sum = sum(all_responses)

print(f"测试完成:总请求数:{total_requests}")
print(f"成功请求数:{success_count}")
print(f"总响应时间:{total_rt_sum:.3f}s")
print(f"平均响应时间:{avg_rt:.3f}s")
print(f"最短响应时间:{min_rt:.3f}s")
print(f"最长响应时间:{max_rt:.3f}s")
print(f"平均成功响应时间:{avg_success_rt:.3f}s")

if __name__ == "__main__":
main()
```

### Environment

- **Dae version (use `dae --version`)**:v1.0.0rc1
- **OS (e.g `cat /etc/os-release`)**:Debian GNU/Linux 12 (bookworm) x86_64
- **Kernel (e.g. `uname -a`)**:6.12.9+bpo-amd64
- **Others**:

### Anything else?

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the reported behavior using the DNS upstream and route configuration in the issue, then run the supplied main.py workload against the dae address. Trace the DNS requests as concurrency and query volume increase, and identify where requests stop responding or time out. Done means repeated benchmark traffic no longer causes slower resolution, failed node-domain lookups, or DNS timeouts.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, python
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.