Drupal 8: How to Handle Errors After Updating Core or Modules

I think we should doubt cache since Drupal 8 aggressively uses cache-backend mechanism. If you encounter a fatal error or WSOD (White Screen of Death), check the following items.

  • Check error logs at /var/log/apache2/error.log
sudo tail -f /var/log/apache2/error.log
  • Configuration | Performance - Check off Aggregate CSS files and Aggregate JavaScript files
  • Configuration | Performance - Clear all caches
  • Rebuild cache from Drush
# Move to the directory where Drupal 8 is installed by using cd command,
sudo drush -l <YOUR_SITE_URL> cr
  • Try each cache from Drush, too.
# Move to the directory where Drupal 8 is installed by using cd command,
sudo drush -l <YOUR_SITE_URL> cc
  • Rebuild cache from Drupal console
# Move to the directory where Drupal 8 is installed by using cd command,
sudo drupal -l=<YOUR_SITE_URL> cr
  • IMPORTANT: You may want to clear cache-related tables on your database:
TRUNCATE `cachetags`;
TRUNCATE `cache_bootstrap`;
TRUNCATE `cache_config`;
TRUNCATE `cache_container`;
TRUNCATE `cache_data`;
TRUNCATE `cache_default`;
TRUNCATE `cache_discovery`;
TRUNCATE `cache_dynamic_page_cache`;
TRUNCATE `cache_entity`;
TRUNCATE `cache_library`;
TRUNCATE `cache_menu`;
TRUNCATE `cache_render`;
TRUNCATE `cache_static`;
TRUNCATE `cache_toolbar`;
  • You may delete the following files/directories (sites/default/files/css or js or php).
sudo rm -fr sites/default/files/css; sudo rm -fr sites/default/files/js; sudo rm -fr sites/default/files/php
  • Restart apache2 because the cache might exist in memory in case of Class Not Found Error. You may also want to restart memcached and mysql server.
sudo service apache2 restart; sudo service memcached restart; sudo service mysql restart
  • Check the remaining disk space.
sudo df -h
  • Finally, try to reboot your server if you try above all.
sudo reboot