DNS resolution unexpectedly stops after upgrade to 5.0

Maybe that's the problem: for some reason pihole doesn't use the prepared value but instead calculates the number of distinct domains from vw_gravity again....

Might be useful to add an explicite debug log for a) using the prepared value b) re-calculating. Right now it uses Querying count of distinct domains in gravity database table vw_gravity for both situations if I understand the code correctly. (Might also help here: Pi-Hole goes offline for several minutes after adding entry to whitelist · Issue #3507 · pi-hole/pi-hole · GitHub)