Quite suddenly, my site has begun behaving erratically. No matter whether the page is an admin page, or a page using my custom theme I receive the 'unexpected error' page whenever I visit the page for the first time. Strangely when I visit it the second it time it appears just fine. The error log within Drupal does not display any corresponding errors, however I do see errors in my nginx log. Here is an example error that appears
#1 /var/www/(my domain)/http/web/core/lib/Drupal/Core/Database/Database.php(376): Drupal\Core\Database\Driver\mysql\Connection::open(Array)
#2 /var/www/(my domain)/http/web/core/lib/Drupal/Core/Database/Database.php(166): Drupal\Core\Database\Database::openConnection('default', 'default')
#3 [internal function]: Drupal\Core\Database\Database::getConnection('default')
#4 /var/www/(my domain)/http/web/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php(79): call_user_func_array('Drupal\Core\Dat...', Array)
#5 /var/www/(my domain)g/http/web/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drup" while reading response header from upstream, client: (my ip) server: (my domain), request: "GET /admin/reports/dblog HTTP/1.1", upstream: "fastcgi://unix/php-fpm.sock:" host: "(my domain)", referrer: "https://(my domain)/admin/reports/status"
I've tested the connection to my sql server and have had no issues. I've reverted to previous commits that I know worked in case the code for my custom themes and modules caused an issue. But I feel like that wouldn't be the cause if it's happening to admin pages as well. I have not done anything like a composer update or install, all the files outside my custom theme and modules shouldn't have changed.
Do the error messages point to any culprit? Is this specifically an issue with my Drupal site?
UPDATE: It occurred to me that it's possible that it's only working the second time because grabbing something cached. So there's a possibility that it's not working at all.