diff --git a/core/core.services.yml b/core/core.services.yml
index cf4ebab..7ca972d 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -607,7 +607,7 @@ services:
     class: Drupal\Core\Transliteration\PHPTransliteration
   flood:
     class: Drupal\Core\Flood\DatabaseBackend
-    arguments: ['@database', '@request']
+    arguments: ['@database', '@request_stack']
   plugin.manager.mail:
     class: Drupal\Core\Mail\MailManager
     arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@module_handler', '@config.factory']
diff --git a/core/lib/Drupal/Core/Flood/DatabaseBackend.php b/core/lib/Drupal/Core/Flood/DatabaseBackend.php
index 0bc30d1..95b19ff 100644
--- a/core/lib/Drupal/Core/Flood/DatabaseBackend.php
+++ b/core/lib/Drupal/Core/Flood/DatabaseBackend.php
@@ -8,6 +8,7 @@
 namespace Drupal\Core\Flood;
 
 use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\RequestStack;
 use Drupal\Core\Database\Connection;
 
 /**
@@ -27,7 +28,7 @@ class DatabaseBackend implements FloodInterface {
    *
    * @var \Symfony\Component\HttpFoundation\Request
    */
-  protected $request;
+  protected $requestStack;
 
   /**
    * Construct the DatabaseBackend.
@@ -35,12 +36,12 @@ class DatabaseBackend implements FloodInterface {
    * @param \Drupal\Core\Database\Connection $connection
    *   The database connection which will be used to store the flood event
    *   information.
-   * @param \Symfony\Component\HttpFoundation\Request $request
-   *   The HttpRequest object representing the current request.
+   * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
+   *   The request stack used to retrieve the current request.
    */
-  public function __construct(Connection $connection, Request $request) {
+  public function __construct(Connection $connection, RequestStack $request_stack) {
     $this->connection = $connection;
-    $this->request = $request;
+    $this->requestStack = $request_stack;
   }
 
   /**
@@ -48,7 +49,7 @@ public function __construct(Connection $connection, Request $request) {
    */
   public function register($name, $window = 3600, $identifier = NULL) {
     if (!isset($identifier)) {
-      $identifier = $this->request->getClientIp();
+      $identifier = $this->getDefaultIdentifier();
     }
     $this->connection->insert('flood')
       ->fields(array(
@@ -65,7 +66,7 @@ public function register($name, $window = 3600, $identifier = NULL) {
    */
   public function clear($name, $identifier = NULL) {
     if (!isset($identifier)) {
-      $identifier = $this->request->getClientIp();
+      $identifier = $this->getDefaultIdentifier();
     }
     $this->connection->delete('flood')
       ->condition('event', $name)
@@ -78,7 +79,7 @@ public function clear($name, $identifier = NULL) {
    */
   public function isAllowed($name, $threshold, $window = 3600, $identifier = NULL) {
     if (!isset($identifier)) {
-      $identifier = $this->request->getClientIp();
+      $identifier = $this->getDefaultIdentifier();
     }
     $number = $this->connection->select('flood', 'f')
       ->condition('event', $name)
@@ -99,4 +100,17 @@ public function garbageCollection() {
       ->execute();
   }
 
+  /**
+   * Return the default identifier.
+   */
+  protected function getDefaultIdentifier() {
+    $request = $this->requestStack->getCurrentRequest();
+
+    if (!$request) {
+      $request = Request::createFromGlobals();
+    }
+
+    return $request->getClientIp();
+  }
+
 }
