AdguardTeam / dnsproxy

Simple DNS proxy with DoH, DoT, DoQ and DNSCrypt support
Apache License 2.0
2.37k stars 246 forks source link

DNSPROXY Memory leak #96

Open liang-hiwin opened 4 years ago

liang-hiwin commented 4 years ago

DNSPROXY Memory leak is very serious, causing the program to become unresponsive.

ameshkov commented 4 years ago

Please supply more details.

  1. How to reproduce this?
  2. What kind of memory leak?
  3. What is the exact configuration of dnsproxy?
ameshkov commented 4 years ago
  1. Please enable logging by adding these arguments: -v -o log.txt
  2. When this issue happens again, please send us the log to devteam@adguard.com
  3. Please note that the log may be quite huge so you may need to archive it first (use gzip or something like this)
liang-hiwin commented 4 years ago
  1. Please enable logging by adding these arguments: -v -o log.txt
  2. When this issue happens again, please send us the log to devteam@adguard.com
  3. Please note that the log may be quite huge so you may need to archive it first (use gzip or something like this)

ok, I am configuring LOG, when it reappears, I will send the log to your support mailbox.

hann-wang commented 3 years ago

There is obviously something wrong if you have a stateful firewall configured. Running DNSPROXY for a few minutes in a small office network and there will be thousands of HTTPS sessions opened by DNSPROXY.

I think the implementation of getClient() in upstream_doh.go is incorrect and it opens a lot of HTTP transports without using the existing ones. All transports are refreshed with a fixed time period: transportDefaultReadIdleTimeout and they are never terminated.