Getting 500 Internal Server Error every few days

Expected Behaviour:

Using a Raspberry Pi Zero W on Mac OS. I expect to be able to login to my Pi-hole dashboard through http://192.168.1.21/admin/.

Actual Behaviour:

Every day or so when I try to log into my dashboard via http://192.168.1.21/admin/ I get a 500 Internal Server Error. Eventually my internet will stop functioning entirely.

Debug Token:

https://tricorder.pi-hole.net/grz0hz8ui6

Are you having to reset the time on this Pi? Your debug log shows that the time was recently reset:

** [ DIAGNOSING ]: contents of /var/log

-rw-r--r-- 1 pihole pihole 411276 Jun 16 03:56 /var/log/pihole-FTL.log
   -----head of pihole-FTL.log------
   [2021-06-16 00:00:12.941 565M] WARN: getOverTimeID(1623798300): 318 is too large: 1623607500

I did not reset the time. I did have to restart the pi by unplugging it to get back to the dashboard though.

That should be your last resort for a Pi restart. It is much preferred to use the following command to restart a Pi:

sudo reboot now

Once I start getting the 500 Internal Server Error, I can no longer connect to my pi via ssh. See SSH debug below:

OpenSSH_8.1p1, LibreSSL 2.7.3

debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.1.21 is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.1.21 [192.168.1.21] port 22.
debug1: Connection established.
debug1: identity file /Users/--/.ssh/id_rsa type 0
debug1: identity file /Users/--/.ssh/id_rsa-cert type -1
debug1: identity file /Users/--/.ssh/id_dsa type -1
debug1: identity file /Users/--/.ssh/id_dsa-cert type -1
debug1: identity file /Users/--/.ssh/id_ecdsa type -1
debug1: identity file /Users/--/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/--/.ssh/id_ed25519 type -1
debug1: identity file /Users/--/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/--/.ssh/id_xmss type -1
debug1: identity file /Users/--/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
kex_exchange_identification: read: Connection reset by peer

This error at the OS level is outside of Pi-hole. SSH is an OS function.

After trying a various fixes I found in other forums to no success, I did a fresh install of Raspberry Pi OS and Pi-hole. Everything has been working smoothly now.