diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index a3a0f46..0a8641c 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -2256,7 +2256,11 @@ function _drupal_exception_handler($exception) {
 
   try {
     // Log the message to the watchdog and return an error page to the user.
-    _drupal_log_error(_drupal_decode_exception($exception), TRUE);
+    $response = _drupal_log_error(_drupal_decode_exception($exception), TRUE);
+    // _drupal_log_error() only returns a Response in fatal error cases.
+    if (!is_null($response)) {
+        $response->send();
+    }
   }
   catch (Exception $exception2) {
     // Another uncaught exception was thrown while handling the first one.
diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc
index 37775e6..5afb117 100644
--- a/core/includes/theme.maintenance.inc
+++ b/core/includes/theme.maintenance.inc
@@ -4,6 +4,8 @@
  * @file
  * Theming for maintenance pages.
  */
+use Drupal\Core\DependencyInjection\MaintenanceContainerBuilder;
+use Symfony\Component\DependencyInjection\Reference;
 
 /**
  * Sets up the theming system for maintenance page.
@@ -42,6 +44,17 @@ function _drupal_maintenance_theme() {
       require_once DRUPAL_ROOT . '/core/includes/database.inc';
     }
 
+    // Bootstrap a minimal container if one hasn't been created yet.
+    if (is_null(drupal_container())) {
+      $container = new MaintenanceContainerBuilder();
+      drupal_container($container);
+    }
+
+    // Need caching to be configured but don't actually want it in this
+    // situation, so use the NullBackend.
+    require_once DRUPAL_ROOT . '/core/includes/cache.inc';
+    $conf['cache_classes'] = array('cache' => 'Drupal\Core\Cache\NullBackend');
+
     // We use the default theme as the maintenance theme. If a default theme
     // isn't specified in the database or in settings.php, we use Bartik.
     // @todo Should use the actual default theme configured, but that depends on
