Dnsmasq stops occasionaly

Started by gunnarf, November 03, 2025, 08:49:14 AM

Previous topic - Next topic
this morning I found the pid changed... so I updated the monitor loop to pick up the new PID if it changes again...

sh -c 'while true; do ps -o pid,rss,command -p `cat /var/run/dnsmasq.pid`; date; sleep 3600; done' >> dns_mem_usage.out &

Hi!  It looks like the memory is usage is increasing.  See attached log file.

Here are the last few lines...
  PID    RSS COMMAND
27052 862192 /usr/local/sbin/dnsmasq -x /var/run/dnsmasq.pid -C /usr/local/etc/dnsmasq.conf
Tue Jan 13 10:02:59 EST 2026
  PID    RSS COMMAND
27052 875284 /usr/local/sbin/dnsmasq -x /var/run/dnsmasq.pid -C /usr/local/etc/dnsmasq.conf
Tue Jan 13 11:02:59 EST 2026
  PID    RSS COMMAND
27052 888480 /usr/local/sbin/dnsmasq -x /var/run/dnsmasq.pid -C /usr/local/etc/dnsmasq.conf
Tue Jan 13 12:02:59 EST 2026
  PID    RSS COMMAND
27052 902784 /usr/local/sbin/dnsmasq -x /var/run/dnsmasq.pid -C /usr/local/etc/dnsmasq.conf
Tue Jan 13 13:02:59 EST 2026

It looks like it increases indeed. What features are you using? Can you share the /usr/local/etc/dnsmasq.conf

How stable is your WAN connection, do you have any churn in the files or folders referenced in dnsmasq.conf?

E.g very fast lease churn by some aggressive clients, or lots of hostname changes etc... It would be great if we can find the exact feature in the dnsmasq.conf that causes this.

Would be great if this is somehow reproducible.
Hardware:
DEC740

Hi.  I don't see a lot of churn on the files referenced in the conf file
root@OPNsense:/usr/local/etc/dnsmasq.conf.d # ls -l
total 16
-rw-r--r--  1 root wheel  85 Dec 18 08:13 README
-rw-r--r--  1 root wheel  41 Sep 15 15:21 jdownloader.conf
-rw-r--r--  1 root wheel 211 Sep 14 21:26 lucid.conf
-rw-r--r--  1 root wheel  31 Sep 14 19:41 plex.conf

I'm attaching my dnsmasq.conf.  I don't think I'm doing anything special with my installation. 

My WAN connection is stable.  I don't see instability in it but if you tell me what to look for then I can validate the logs to be certain. 


January 13, 2026, 09:35:19 PM #19 Last Edit: January 13, 2026, 09:37:04 PM by Monviech (Cedrik)
You are indeed not doing anything strange (other than having some custom config files but that can be found out).
Can you try some of these things:

- 1. comment these out, one by one, see if anything changes. If we know the exact folder/file that would be great:
(Go to /usr/local/opnsense/service/templates/OPNsense/Dnsmasq/dnsmasq.conf and just put a "#" before these lines one by one. Then restart dnsmasq via Apply in the GUI each time and monitor for a while)
# addn-hosts=/var/etc/dnsmasq-hosts
# addn-hosts=/var/etc/dnsmasq-leases
# conf-dir=/usr/local/etc/dnsmasq.conf.d,*.conf

- 2. Random guess, can you try to disable Router Advertisements/DHCPv6 in the GUI and see if that changes anything?

Try these one by one and see if it changes anything.


PS: Just make sure to mask your dhcp-host entries in that prior dnsmasq.conf file attached to your post, so not everyone knows your network.
Hardware:
DEC740