I've recently set up a Pi Zero W with the as-of-writing most recent Pi OS Lite image. It is connected to my home network via Ethernet and has Pi-hole installed on it. I found that during setup and, more noticeably while making DNS queries to it, I would occasionally see "hangs" where my SSH terminal would stop responding to input, or DNS queries would take longer than normal generally without seeing any noticeable spike in CPU/memory usage, after which the connection would return to normal.

For instance, if I run the following

# using pi zero as DNS server, time fetching A records for wikipedia.org 50x
$ for i in {1..50}; do
>   /usr/bin/time -f 'real %e' dig @pizero.local +noall +answer wikipedia.org
> done

wikipedia.org.          320     IN      A
real 0.03
wikipedia.org.          320     IN      A
real 0.01
wikipedia.org.          320     IN      A
real 0.02

I would see ~45 responses in 0.01s or 0.02s real time, but the other 5 would instead be 5.01s or 5.02s durations.

Initially, I suspected the default 100MiB configured swap space might be the culprit, but removing the swap did not improve this behavior. I've not installed any other services, and was experiencing this behavior prior to installing Pi-hole while editing files with vim or doing other activities requiring interactive input. What could be causing this?

  • As a test, add options timeout:2 to /etc/resolv.conf and do the dig-loop again. If the delays are now 2 seconds in stead of 5 seconds, the problem is in the name resolution. That may be a client-side problem or the nameserver being unavailable. But then it is not cpu or memory problems directly. May 5, 2022 at 9:35
  • I'll let you know when I can connect to test that. Presently, even trying to connect to the device via ssh is yielding: ssh: connect to host pizero.local port 22: No route to host May 5, 2022 at 23:04
  • @LjmDullaart Making this change (on both the host and the pi) and restarting the network interface via sudo /etc/init.d/networking restart has no effect; the same outcome occurs. May 8, 2022 at 6:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.