dnsproxy: HTTP3 upstream memory leak

RAM USAGE too much after running 2 hours.

systemctl status adguard-dnsproxy
● adguard-dnsproxy.service - dnsproxy
     Loaded: loaded (/etc/systemd/system/adguard-dnsproxy.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-11-02 15:16:50 WIB; 2h 43min ago
       Docs: https://github.com/AdguardTeam/dnsproxy#readme
   Main PID: 27947 (dnsproxy-helper)
      Tasks: 10 (limit: 2359)
     Memory: 1.2G
        CPU: 22min 44.463s
     CGroup: /system.slice/adguard-dnsproxy.service
             ├─27947 /bin/sh /opt/adguard/dnsproxy-helper.sh start
             └─27973 /opt/adguard/dnsproxy --listen=127.0.2.1 --config-path=/etc/adguard/dnsproxy.yml

python3 ps_mem.py
 Private  +   Shared  =  RAM used	Program

  4.0 KiB +   0.5 KiB =   4.5 KiB	dhclient
  4.0 KiB +   0.5 KiB =   4.5 KiB	unattended-upgr
  4.0 KiB +   1.5 KiB =   5.5 KiB	dnsproxy-helper
  8.0 KiB +   1.0 KiB =   9.0 KiB	agetty (2)
 28.0 KiB +   8.5 KiB =  36.5 KiB	dbus-daemon
 32.0 KiB +  16.5 KiB =  48.5 KiB	polkitd
 44.0 KiB +   8.0 KiB =  52.0 KiB	chronyd (2)
100.0 KiB +   5.5 KiB = 105.5 KiB	systemd-udevd
132.0 KiB +  32.5 KiB = 164.5 KiB	cron
108.0 KiB +  64.5 KiB = 172.5 KiB	systemd-resolved
112.0 KiB +  78.5 KiB = 190.5 KiB	systemd-logind
260.0 KiB +  18.5 KiB = 278.5 KiB	packagekitd
364.0 KiB +  63.5 KiB = 427.5 KiB	vnstatd
496.0 KiB +  30.5 KiB = 526.5 KiB	rsyslogd
560.0 KiB + 229.5 KiB = 789.5 KiB	systemd (3)
  1.2 MiB + 118.5 KiB =   1.3 MiB	bash
  4.3 MiB + 679.5 KiB =   4.9 MiB	nginx (3)
  7.9 MiB + 225.5 KiB =   8.1 MiB	systemd-journald
  3.0 MiB +   6.2 MiB =   9.2 MiB	sshd (5)
338.6 MiB +   0.5 KiB = 338.6 MiB	nginx-rc
  1.2 GiB +   0.5 KiB =   1.2 GiB	dnsproxy
---------------------------------
                          1.5 GiB
=================================

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 23 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Well, so it’s confirmed that the problem is in the DoH3 upstream implementation.

We’ll need a pprof dump then.

Can you build dnsproxy from my branch https://github.com/AdguardTeam/dnsproxy/tree/pprof ?

If you can, then please do the following:

  1. Run it for some time with --pprof flag
  2. Then when the memory usage is high enough, download http://localhost:6060/debug/pprof/heap and share with me

okay, i removed parameter http3: yes and resolver h3 also DoQ, still with 25MB rmem_max to see the different.

sorry i did typo, since i used the premium resolver from them so i changes it to public resolver.

I saw in your fork that you set “rmem_max” to 26214400 bytes (25 MB) MB for each socket, but shouldn’t it be 2621440 bytes (2,5 MB). Could this be a reason for memory growing fast?!

sudo sh -c 'echo "net.core.rmem_max=26214400" >> /etc/sysctl.conf'

i following various tutorials, indeed i am set them to 25MB at the moment. is it causing the memory usage so high?