From fcac699e777e169666db59685c6ece47877742a0 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Sun, 31 Jul 2011 23:34:33 -0400
Subject: [PATCH] - Patch #1216886 by pounard: _lock_id() shouldn't use
 drupal_static(), any cache clear would potentially make locks stall.

---
 includes/lock.inc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/includes/lock.inc b/includes/lock.inc
index 42f1906f2572..7dd8db30a163 100644
--- a/includes/lock.inc
+++ b/includes/lock.inc
@@ -74,7 +74,10 @@ function lock_initialize() {
  * Helper function to get this request's unique id.
  */
 function _lock_id() {
-  $lock_id = &drupal_static(__FUNCTION__);
+  // Do not use drupal_static(). This identifier refers to the current
+  // client request, and must not be changed under any circumstances
+  // else the shutdown handler may fail to release our locks.
+  static $lock_id;
 
   if (!isset($lock_id)) {
     // Assign a unique id.
-- 
GitLab