apsd/mDNSResponder spamming thousands of DNS queries per second on macOS Big Sur

I upgraded a machine to macOS Big Sur two days ago, and after a day or so my PiHole DNS server randomly stopped working, which upon inspection was caused by gigabytes of logs for DNS queries made by the Big Sur machine overwhelming the poor thing. I monitored DNS requests on the machine with tcpdump:

$ sudo tcpdump port 53 -k NP
xx:xx:xx.xxxx (proc mDNSResponder:32622, eproc apsd:108) IP 192.168.0.xxx.xxxxx > pi.domain: 24541+ A? xxx-courier-x.push-apple.com.akadns.net. (64)
...

and holy crap, apsd, the Apple Push Notification Service daemon, was literally spamming multiple DNS queries for xxx-courier-x.push-apple.com.akadns.net through mDNSResponder every millisecond (the domain is obfuscated a bit here; the 5th level domain is different for different geographical regions).

Note that the DNS queries are answered just fine, the domain isn't blocked by PiHole or anything.

I killed mDNSResponder which made it stop, which might indicate that apsd is the innocent party and mDNSResponder is the culprit, but I can't be sure.

I then rebooted out of caution, and after a day or so, the problem started again.

I've never seen anything like this on previous versions of macOS. Anyone got insight? Or experiencing something similar and have more details to add?


This keeps coming up every day or two, so eventually I wrote a small utility called mDNSSupervisor to monitor mDNSResponder and restart it whenever it's apparently going berserk. Doesn't solve the underlying issue of course but enough to cure the symptom and be mostly safe from its effects.

You can download the tool if you want from https://github.com/zmwangx/mDNSSupervisor (free, WTFPL licensed). Installation instructions there, too.

A sample from my logs showing it in action:

time="2020-11-28T17:15:06+00:00" level=info msg="1606583706: 15s rolling average 142.8, above threshold 100"
  PID  %CPU    RSS  ELAPSED COMMAND
  246  38.2   7692 14:01:57 /usr/sbin/mDNSResponder
  259   0.0   4768 14:01:57 /usr/sbin/mDNSResponderHelper
time="2020-11-28T17:15:06+00:00" level=info msg="mDNSResponder restarted"