[Dnsmasq-discuss] dnsmasq stuck at reading socket

Simon Kelley simon at thekelleys.org.uk
Sat Oct 16 20:29:22 UTC 2021



On 16/10/2021 21:18, Juhyung Park wrote:
> On Sun, Oct 17, 2021 at 5:06 AM Simon Kelley <simon at thekelleys.org.uk> wrote:
>>
>> Are you running dnsmasq in debug mode?
>>
> 
> Nope, the only argument passed to dnsmasq executable is --no-daemon.
> The rest is set up via /etc/dnsmasq.conf, which is provided in the
> earlier email.
> 

   -d, --no-daemon
       Debug mode: don't fork to the  background,  don't  write  a  pid
       file,  don't  change  user id, generate a complete cache dump on
       receipt on SIGUSR1, log to stderr as well as syslog, don't  fork
       new  processes  to  handle TCP queries. Note that this option is
       for use in debugging only, to stop dnsmasq daemonising  in  pro‐
       duction, use --keep-in-foreground.


So is something opens a TCP connection to dnsmasq then fails to close it
again, exactly the behaviour you're seeing is expected. The last
sentence tells you what to do instead.


Cheers,

Simon.



> Thanks.
> 
>> Simon.
>>
>>
>> On 16/10/2021 15:17, Juhyung Park wrote:
>>> Hi.
>>>
>>> I'm trying to debug an issue with dnsmasq that gets completely
>>> unresponsive after a few days of uptime.
>>>
>>> We have dnsmasq setup to serve as a DHCP server to local, wired
>>> network (192.168.10.0/24) and as a DNS resolver to local and WireGuard
>>> VPN network (192.168.240.0/24).
>>>
>>> After the dnsmasq daemon runs for a few days, it gets completely
>>> unresponsive. DHCP isn't renewed, DNS resolver doesn't work, etc.
>>>
>>> Using strace, I'm able to see that it's blocked from reading a socket:
>>> # strace -f -p 342291
>>> strace: Process 342291 attached
>>> read(13, ^Cstrace: Process 342291 detached
>>>  <detached ...>
>>>
>>> dnsmasq.conf:
>>> bogus-priv
>>> cache-size=5000
>>> domain-needed
>>> no-negcache
>>> no-resolv
>>> no-poll
>>> no-hosts
>>> log-facility=/dev/kmsg
>>>
>>> # DHCP
>>> dhcp-range=192.168.10.2,192.168.10.254,255.255.255.0
>>> dhcp-no-override
>>> dhcp-authoritative
>>> dhcp-lease-max=253
>>> dhcp-option=6,192.168.10.1
>>>
>>> server=164.124.101.2
>>>
>>> /proc/?/fd:
>>> /proc/342291/fd# ll
>>> total 0
>>> dr-x------ 2 root root  0 Oct 16 22:30 ./
>>> dr-xr-xr-x 9 root root  0 Oct 16 18:53 ../
>>> lr-x------ 1 root root 64 Oct 16 22:30 0 -> 'pipe:[3988]'
>>> l-wx------ 1 root root 64 Oct 16 22:30 1 -> /dev/null
>>> lr-x------ 1 root root 64 Oct 16 22:30 10 -> 'pipe:[526396]'
>>> l-wx------ 1 root root 64 Oct 16 22:30 11 -> 'pipe:[526396]'
>>> l-wx------ 1 root root 64 Oct 16 22:30 12 -> /dev/kmsg
>>> lrwx------ 1 root root 64 Oct 16 22:30 13 -> 'socket:[2740642]'
>>> l-wx------ 1 root root 64 Oct 16 22:30 2 -> /dev/null
>>> lrwx------ 1 root root 64 Oct 16 22:30 3 -> /var/lib/misc/dnsmasq.leases
>>> lrwx------ 1 root root 64 Oct 16 22:30 4 -> 'socket:[526385]'
>>> lrwx------ 1 root root 64 Oct 16 22:30 5 -> 'socket:[526386]'
>>> lrwx------ 1 root root 64 Oct 16 22:30 6 -> 'socket:[526388]'
>>> lrwx------ 1 root root 64 Oct 16 22:30 7 -> 'socket:[526389]'
>>> lrwx------ 1 root root 64 Oct 16 22:30 8 -> 'socket:[526390]'
>>> lrwx------ 1 root root 64 Oct 16 22:30 9 -> 'socket:[526391]'
>>>
>>> lsof:
>>> # lsof -i -a -p 342291
>>> COMMAND    PID USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
>>> dnsmasq 342291 root    4u  IPv4  526385      0t0  UDP *:bootps
>>> dnsmasq 342291 root    6u  IPv4  526388      0t0  UDP *:domain
>>> dnsmasq 342291 root    7u  IPv4  526389      0t0  TCP *:domain (LISTEN)
>>> dnsmasq 342291 root    8u  IPv6  526390      0t0  UDP *:domain
>>> dnsmasq 342291 root    9u  IPv6  526391      0t0  TCP *:domain (LISTEN)
>>> dnsmasq 342291 root   13u  IPv4 2740642      0t0  TCP
>>> 192.168.240.1:domain->192.168.240.103:63169 (ESTABLISHED)
>>>
>>> It seems that a WireGuard client DNS socket (fd 13) is forever
>>> blocked. Since I'm not sure as to whether this is WireGuard's or
>>> dnsmasq's issue, I figured I'd try contacting dnsmasq mailing list
>>> first.
>>>
>>> dnsmasq is version 2.85, but we've tried older versions as well.
>>>
>>> Any suggestions?
>>>
>>> Thanks.
>>>
>>> _______________________________________________
>>> Dnsmasq-discuss mailing list
>>> Dnsmasq-discuss at lists.thekelleys.org.uk
>>> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
>>>
>>
>> _______________________________________________
>> Dnsmasq-discuss mailing list
>> Dnsmasq-discuss at lists.thekelleys.org.uk
>> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
> 



More information about the Dnsmasq-discuss mailing list