Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 314173

Lock system needs a precision of at least 14

$
0
0

If this is not given then in the database backend all kinds of strange things can happen that the db_update fails (as expire is the same) and such a process cannot extend its own lock ...

This is very easy to reproduce by using memcache and memcache's stampede protection, but then not using memcache's lock.inc.

This can also be reproduced by the following script:

<?php
$x
= lock_acquire('a', 15);
$y = lock_acquire('a', 15);
$z = lock_acquire('a', 15);
?>

Where $y and $z fail ...

D7 patch:

diff --git a/includes/lock.inc b/includes/lock.inc
index 7dd8db3..f426341 100644
--- a/includes/lock.inc
+++ b/includes/lock.inc
@@ -67,6 +67,11 @@
function lock_initialize() {
   global $locks;
+  // The lock system needs at least a precision of 14.
+  if (ini_get('precision') < 14) {
+    ini_set('precision', 14);
+  }
+
   $locks = array();
}

Viewing all articles
Browse latest Browse all 314173

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>