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:


$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();
 }
 
CommentFileSizeAuthor
#83 2077827-83-precision14-7x_do_not_test.patch676 bytesMile23
#77 core-lock-system-not-enough-precision-2077827-77-D8.patch743 bytesKrzysztof Domański
#66 lock_system_needs_a-2077827-49.patch750 bytesmgifford
#50 interdiff-2077827-44-49.txt2.05 KBnlisgo
#49 interdiff-2077827-44-49.patch2.05 KBnlisgo
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch interdiff-2077827-44-49.patch. Unable to apply patch. See the log in the details link for more information. View
#49 lock_system_needs_a-2077827-49.patch750 bytesnlisgo
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 80,853 pass(es). View
#44 lock_system_needs_a-2077827-44.patch2.79 KBnlisgo
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 80,559 pass(es). View
#44 interdiff-2077827-37-44.txt2.31 KBnlisgo
#37 interdiff-2077827-34-37.txt663 bytesnlisgo
#37 lock_system_needs_a-2077827-37.patch2.41 KBnlisgo
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 80,684 pass(es). View
#34 interdiff-2077827-28-34.txt661 bytesnlisgo
#34 lock_system_needs_a-2077827-34.patch2.33 KBnlisgo
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 79,653 pass(es). View
#28 lock_system_needs_a-2077827-28.patch2.2 KBnlisgo
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 79,658 pass(es). View
#28 interdiff-2077827-25-28.txt743 bytesnlisgo
#25 lock_system_needs_a-2077827-25.patch2.12 KBnlisgo
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 79,657 pass(es). View
#15 drupal_core-lock_system_precision-fails-2077827-15.patch2.1 KBjorgegc
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 66,338 pass(es), 1 fail(s), and 0 exception(s). View
#15 drupal_core-lock_system_precision-passes-2077827-15.patch2.08 KBjorgegc
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 66,343 pass(es). View
#14 drupal_core-lock_system_precision-2077827-14.patch1.25 KBjorgegc
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 65,316 pass(es). View
#5 drupal_core-lock_system_precision-2077827-5.patch1.2 KBPete B
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch drupal_core-lock_system_precision-2077827-5.patch. Unable to apply patch. See the log in the details link for more information. View
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Fabianx’s picture

Title: Lock needs a precission of at least 14 » Lock system needs a precision of at least 14
Issue tags: +Needs backport to D7

.

Fabianx’s picture

Issue tags: +Novice

Tagging novice to create a proper patch for D8

littledynamo’s picture

Assigned: Unassigned » littledynamo

We'll tackle this one at our code sprint next week.

littledynamo’s picture

Assigned: littledynamo » Unassigned
Pete B’s picture

Status: Active » Needs review
FileSize
1.2 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch drupal_core-lock_system_precision-2077827-5.patch. Unable to apply patch. See the log in the details link for more information. View

Patch for this

Fabianx’s picture

Looks, good, this will need some Tests.

pingers’s picture

What would we be testing? ini_set()? Not sure this does need tests.

I don't think it was mentione: 14 is the default precision for PHP. http://www.php.net/manual/en/ini.core.php#ini.precision

Fabianx’s picture

Status: Needs review » Reviewed & tested by the community

Yeah, in that case this is probably good to go.

webchick’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Can we get the script in the OP as an automated test so we don't break this again?

martin107’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 5: drupal_core-lock_system_precision-2077827-5.patch, failed testing.

martin107’s picture

Issue summary: View changes
Issue tags: +Needs reroll
jorgegc’s picture

Assigned: Unassigned » jorgegc

I am happy to do a reroll for patch in #5.

jorgegc’s picture

Assigned: jorgegc » Unassigned
Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
1.25 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 65,316 pass(es). View

Rerolled patch in #5.

jorgegc’s picture

FileSize
2.08 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 66,343 pass(es). View
2.1 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 66,338 pass(es), 1 fail(s), and 0 exception(s). View

As required by @webchick, I've rewritten the patch and included a test for the precision. Let's see what the test bot comes back with!

Status: Needs review » Needs work

The last submitted patch, 15: drupal_core-lock_system_precision-fails-2077827-15.patch, failed testing.

benjy’s picture

Status: Needs work » Needs review
+++ b/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php
@@ -35,10 +35,19 @@ public static function getInfo() {
+    // Locks require a precision of at least 14.

I think we should expand on this a little. It's not clear that we're setting it to 12 so we can later test to ensure that the constructor updated the prevision to at least 14.

jorgegc’s picture

Fair enough @benjy.

@Fabianx said that the default precision is 14, If that is the case, why did it break?

Damien Tournoud’s picture

Status: Needs review » Postponed (maintainer needs more info)

Instinctively, this sounds like trying to patch the symptoms.

@Fabianx: do you have more detail on why precision matters? From a quick read of the code we don't seem to be doing any floating point manipulation, other then the expiration logic that we could get rid of, and should not affect the normal code path.

Fabianx’s picture

Status: Postponed (maintainer needs more info) » Needs review

I don't remember the details anymore, but if you use a precision of 12, you get a DB query that is comparing timestamps, but the timestamps are the same.

so the lock_acquire fails - even though you hold the lock ...

leading to very strange behavior.

Xen’s picture

Priority: Major » Critical

DatabaseLockBackend::aquire calls microtime(true) which returns a float. That is then rendered into a string for the SQL, and it makes sense that's where precision kicks in. Testing locally, with a precision of 12, the timestamp gets rendered with only two decimal digits, which is sure to mess something up. Basically, it only prints decimal digits up until the precision.

One way to avoid the problem would be to use microtime() and do some string manipulation to get the proper string, but then we're basically passing the buck to the DB. It's currently a big float which should be sufficient, but figuring out the exact limits we need and using a decimal would be a tad safer.

But as this setting influences *all* float rendering, I think it should be promoted to be set in bootstrapping so it's consistent all across.

I'm elevating this to critical as it *will* break Drupal on hosts configured with non-standard precision.

dawehner’s picture

+++ b/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php
@@ -35,10 +35,19 @@ public static function getInfo() {
+    // Locks require a precision of at least 14.
+    ini_set('precision', 12);

Ha, this comment is a bit confusing, let's explain that we test the automatic changing to precision 14 later, maybe with an @see ?

catch’s picture

Status: Needs review » Needs work

Let's fix that comment, otherwise looks RTBC.

gobinathm’s picture

Assigned: Unassigned » gobinathm

will update the comment shortly...

nlisgo’s picture

FileSize
2.12 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 79,657 pass(es). View

Re-roll only. Leaving comment for @gobinathm.

nlisgo’s picture

Status: Needs work » Needs review
nlisgo’s picture

Status: Needs review » Needs work

Awaiting change to comment by @gobinathm

nlisgo’s picture

Status: Needs work » Needs review
FileSize
743 bytes
2.2 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 79,658 pass(es). View
nlisgo’s picture

Assigned: gobinathm » Unassigned
jorgegc’s picture

I thought the comment in __construct() was going to be updated as well to explain why we need a precision of 14.

Fabianx’s picture

+++ b/core/lib/Drupal/Core/Lock/LockBackendAbstract.php
@@ -29,6 +29,16 @@
+  public function __construct() {
+    // Locks require a precision of at least 14.
+    if (ini_get('precision') < 14) {

Indeed lets add some information, why we need a precision of at least 14, see above comments for an explanation.

jorgegc’s picture

Happy to do it @Fabianx given that the poor comment is mine :-)

jorgegc’s picture

Status: Needs review » Needs work
nlisgo’s picture

Status: Needs work » Needs review
FileSize
2.33 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 79,653 pass(es). View
661 bytes
nlisgo’s picture

@jorgegc, I'd all but exported the patch before I saw your messages. Feel free to change the comment.

While looking into the issue to attempt to write an appropriate comment I did stumble across this post: http://php.net/manual/en/function.microtime.php#113078

It is suggested in that post that a precision of 16 could ensure that the full value that microtime returns could be preserved on string conversions. But precision 14 has been found to be enough for this?

I do also wonder if setting this precision value should be more global. microtime() is used extensively in core.

Fabianx’s picture

+++ b/core/lib/Drupal/Core/Lock/LockBackendAbstract.php
@@ -32,7 +32,10 @@
+    // It is vital that an appropriate precision level is set so that reliable
+    // comparisons of timestamps can be made.

Lets add something like:

Else the process that holds the lock and tries to re-acquire it will fail.

nlisgo’s picture

FileSize
2.41 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 80,684 pass(es). View
663 bytes
Fabianx’s picture

It looks great to me, will re-review whole patch later again to RTBC.

catch’s picture

I think we should consider just setting this globally to the higher precision in this issue. The lock system could then throw an exception if it's somehow not set correctly.

Fabianx’s picture

#39 I tend to agree, but where is globally this times? Container level? Drupal Kernel?

catch’s picture

DrupalKernel::bootEnvironment()

Fabianx’s picture

Status: Needs review » Needs work

CNW based on #41 then

nlisgo’s picture

Assigned: Unassigned » nlisgo

I will work on supplying a patch for review later today.

nlisgo’s picture

FileSize
2.31 KB
2.79 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 80,559 pass(es). View

I hope this is what you were going for. Please provide feedback.

nlisgo’s picture

Status: Needs work » Needs review
Fabianx’s picture

Looks great to me.

Fabianx’s picture

Status: Needs review » Reviewed & tested by the community

Let's RTBC this and see what core committers think.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/lib/Drupal/Core/DrupalKernel.php
    @@ -746,6 +746,13 @@ public static function bootEnvironment() {
    +    // Ensure a precision value of at least 14.
    +    // It is vital that an appropriate precision level is set so that reliable
    +    // comparisons of timestamps can be made.
    +    if (ini_get('precision') < 14) {
    +      ini_set('precision', 14);
    +    }
    
    +++ b/core/lib/Drupal/Core/Lock/LockBackendAbstract.php
    @@ -29,6 +29,19 @@
    +    // It is vital that an appropriate precision level is set or the process
    +    // that holds the lock and tries to re-acquire it will fail.
    +
    +    // Ensure a precision value of at least 14.
    +    if (ini_get('precision') < 14) {
    +      throw new \Exception('Precision level less than 14 detected.');
    +    }
    

    Is it really right to throw an exception given that DrupalKernel contains the ini_set()?

  2. +++ b/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php
    @@ -27,6 +27,13 @@ protected function setUp() {
    +  public function testMinimumPrecision() {
    +    $this->assertTrue(ini_get('precision') >= 14);
    +  }
    

    This fail might be wrong. I think we should skip the unit test in this case. DrupalKernal has not run btw so the only reason this passes is that precision is 14 or more on testbots.

nlisgo’s picture

Status: Needs work » Needs review
FileSize
750 bytes
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 80,853 pass(es). View
2.05 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch interdiff-2077827-44-49.patch. Unable to apply patch. See the log in the details link for more information. View

That leaves us with just setting the precision.

It makes sense to remove this test, particularly since DrupalKernel is not run :) The only thing a test or check would protect from is if someone later decided that setting the precision was unnecessary then the problems described in this issue would re-occur. But git blame on this code should lead someone back to this issue before thinking about changing it.

Here is a patch for review.

nlisgo’s picture

FileSize
2.05 KB

Woops! I triggered the testbot with my interdiff because I mistakenly added the .patch extension. Here it is again as .txt :) Sorry testbot!

nlisgo’s picture

Status: Needs review » Needs work

The last submitted patch, 49: interdiff-2077827-44-49.patch, failed testing.

nlisgo’s picture

Status: Needs work » Needs review

Ignore the failed interdiff-2077827-44-49.patch (#holdsheadinshame). Patch in #49 is good for review.

catch’s picture

@alexpott I think it's worth throwing the exception to ensure an early failure if DrupalKernel hasn't run.

alexpott’s picture

ini_set('precision', 8);
$x = \Drupal::lock()->acquire('a', 15);
$y = \Drupal::lock()->acquire('a', 15);
$z = \Drupal::lock()->acquire('a', 15);
var_dump($x);
var_dump($y);
var_dump($z);

This returns:

bool(true)
bool(true)
bool(true)

Is this a memcache only issue?

alexpott’s picture

Status: Needs review » Needs work

Discussed with @nlisgo on IRC I think the problem is in DatabaseLockBackend::lockMayBeAvailable()

    $expire = (float) $lock['expire'];
    $now = microtime(TRUE);
    if ($now > $expire) {

Given:

"So never trust floating number results to the last digit, and do not compare floating point numbers directly for equality. If higher precision is necessary, the arbitrary precision math functions and gmp functions are available."

See http://php.net/manual/en/language.types.float.php - thanks @catch

    $expire = (float) $lock['expire'];
    $now = microtime(TRUE);
    // Test if $now is greater that $expire.
    if (bccomp($now, $expire, 14) == 1) {
nlisgo’s picture

Happy to take on the refactoring of this. Will post up for review.

nlisgo’s picture

The solution proposed in #56 does not address the issue described in #21. If the precision value is not high enough then the expire value that is written to the database will not be fit for a comparison later on in the lockMayBeAvailable method.

What the suggested solution in #56 does draw attention to, however, is that microtime comparisons are only at risk because of the precision setting if the value or values being compared are converted to and from a string.

I think we still need to address the precision setting. But it will strengthen this issue if we can provide more reliable steps to reproduce the issue.

@Fabianx can you respond to #55?

nlisgo’s picture

Status: Needs work » Needs review

In an effort to continue the momentum of this issue. I believe that we should consider the last patch for review again. When reviewing please take on board the comments since the last patch was submitted.

The patch for review is in #49.

xjm’s picture

Title: Lock system needs a precision of at least 14 » Lock system needs a precision of at least 14 for timestamp comparison
Priority: Critical » Major

This fits the definition of a major bug per: https://www.drupal.org/core/issue-priority#major-bugs. There are also workarounds possible on those hosts affected; for example, in Apache configuration, .htaccess, settings.php, etc. Therefore, it need not block release. However, it is major because it will render the system unusable in these cases and will likely be difficult to isolate.

This could also be addressed with a hook_requirements() when a higher precision is needed.

nlisgo’s picture

Assigned: nlisgo » Unassigned
Fabianx’s picture

I just confirmed the bug again for D7:

ini_set('precision', 12);

$x = lock_acquire('a', 15);
$y = lock_acquire('a', 15);
$z = lock_acquire('a', 15);

print_r(array($x,$y,$z));

gives TRUE,FALSE,FALSE.

And MAMP (!) ships still with ini precision 12 by default ...

Trying D8 now ...

Fabianx’s picture

Title: Lock system needs a precision of at least 14 for timestamp comparison » Lock system is broken in many regards (was: needs a precision of at least 14 for timestamp comparison)
Priority: Major » Critical
Issue tags: -Novice

Okay, so this is way way way trickier than I ever expected.

There is a huge BC break in db_update() vs. $this->database->update(), which is exposed by this - unless this is recorded in some change record. EDIT: Yes, this is recorded in a change record, so fine ...

Before db_update() would return 0 when 0 values had been changed, which led to the bug.

Now it returns 1 values.

Basically we get:

insert into semaphore (name,value,expire) VALUES ('a', '104248975354622b38df95c7.95133142', 1415719752);
update semaphore set expire = 1415719752 where name = 'a' AND value = '104248975354622b38df95c7.95133142';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

on both D7 and D8, but Drupal 8 does use Rows matched, while Drupal 7 does use 'Changed' value.

b) The failure condition does not make sense at all. Tentatively setting to critical again (can be demoted again for sure)

Neither in D7 nor in D8.

Consider the rare edge case of a lock being broken, but the process did hold it:

process_A:

$x = lock_wait('a', 2);
start_process_B_in_background();
sleep(10);
$y = lock_wait('a', 2);

process_B:

$x = lock_wait('a', 5);
lock_release('a');

Timeline:

process A: lock_wait('a', 2); // Need it only for 2s, but due to some code it needs longer and process A takes 10s.
process B: lock_wait('a', 5);
process B: lock_release('a');

// The lock a is open at this point.

process A: lock_wait('a', 2); // BOOM! This fails even though, because A thinks it still has the lock.

Proposed resolution for this is:

    if (isset($this->locks[$name])) {
      // ...
      if ($success) {
        return TRUE;
      }
      unset($this->locks[$name]);
   }
   if (!isset($this->locks[$name])) { // instead of the else block, will always be TRUE, so can also remove the block fully ...
   }

So the else {} is faulty and there is still the float comparison problem, ugh ...

Problems of the lock system

- Figure out what is up with the database layer, do we really return affected values instead of changed values now? - create critical follow-up
- Fix precision problem - at least for Drupal 7 - Patch exists
- Fix failure case to be _correct_. Even if I had a lock, I need to re-try gaining the lock if prolonging did not work.
- Figure out what to do with the float comparison and if this has more bugs ...

Fabianx’s picture

Priority: Critical » Major

I found the change record for the DB behavior change:

https://www.drupal.org/node/2019303

Just q question though, can someone set this option to something else?

In this case, the one major part is only the failure case and the float comparison, but also happy to continue with D7 at this point and open another issue for the other problems.

jhedstrom’s picture

The issue summary is quite out of date with more recent comments.

mgifford’s picture

Nephele’s picture

I just encountered this problem. Since this is one of the most frustrating bugs I've had to deal with, I wanted to share some details in case a concrete example is useful. I'm working in D7, but I was able to duplicate the problem in a clean install of D8.1.x

I started the day trying to test a new page I was developing on my test site. But I couldn't get drupal to recognize the new page. I tried to rebuild menus every way I know; disabled and re-enabled the module; etc. But menu-rebuilding just refused to happen, and there were no warnings or messages in any of the logs. At this point I assumed something was broken with the menu system.

But over the next few hours I kept diving deeper and deeper into core code, and eventually tracked the problem to lock_may_be_available(). Apparently a menu rebuild had failed about a month ago, and had left the following entry in the semaphore table:

+--------------+-----------------------------------+-----------------+
| name         | value                             | expire          |
+--------------+-----------------------------------+-----------------+
| menu_rebuild | 190985459756c6119fbb0ec6.22649124 | 1455821246.6831 |
+--------------+-----------------------------------+-----------------+

Attempts to delete the entry were failing because the deletion conditions were rounding expire to two digits (e.g.,
WHERE expire <= 1455821246.68). Therefore all menu_rebuild requests were being silently ignored.

Once I finally found this issue, a D7 version of patch #49 worked (as did the patch provided by the OP). I also duplicated the issue in D8, by inserting the same row into the D8 semaphore table, except with name changed to menuLinksRebuild. The same problem occurred in D8 -- all attempts to rebuild menus were ignored -- and patch #49 fixed the problem. Also note that memcache is not enabled on my test site, but problems still occurred.

One point of my example is to echo #60: lock expiration rounding errors are indeed "difficult to isolate." They make seemingly unrelated drupal components fail and only very determined developers have any chance of identifying the underlying problem. So this may be the cause of many reported errors on this site -- including many errors tagged as unreproducible, given that the behavior depends upon an obscure PHP setting.

I would vote in favor of implementing patch #49, and sooner rather than later, to help resolve all the possibly undiagnosed but related problems. The tests in #44 seem unnecessary, given that testbots will never trigger the error.

However patch #49 is a band-aid rather than a real fix. Perhaps a separate followup issue should be created to explore other, more stable options, that are not dependent upon floating-point rounding. My guess is that development of any such alternative will take some time, which is why the current patch should be implemented first.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

bmx269’s picture

Tested and verified that #66 works

joelpittet’s picture

@webchick and @Fabianx the default PHP setting is 14. What should we be testing?

http://php.net/manual/en/ini.core.php#ini.precision

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

fgm’s picture

Just wondering: any reason why we cannot use an explicit high-accuracy serialization starting from microtime(FALSE) ?

When using that format, the microsecond part appears to have 1E-8 resolution, but 1E-6 accuracy, while microtime(TRUE) only has 1E-4 accuracy.

So we could just replace the double in the semaphore schema by a CHAR(16) (10 digits for seconds, 6 for microseconds) and store the actual microsecond value as a fixed length string. This should both remove the need for the dependency on the PHP precision check and eliminate any risk of rounding error mentioned against @alexpott's code in #56. Think of something like that:

list($micro, $sec) = explode(' ', microtime(FALSE));
$expire = gmp_init($sec . substr($micro, 2, 6));
// The add timeout, etc. And write to DB using gmp_strval().

That timing logic could even be moved to LockBackendAbstract() to allow it to be shared between lock backends.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Krzysztof Domański’s picture

Re-uploading patch for re-testing in 8.6.x-dev.
I used the code from #49. It is the same as #66 so interdiff is not needed.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Krzysztof Domański’s picture

Version: 8.9.x-dev » 9.1.x-dev
Issue tags: +Bug Smash Initiative
quietone’s picture

Status: Needs review » Needs work

Since this needs tests and an IS update, setting to NW.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Mile23’s picture

Here's a 7.x patch for anyone who might find it handy.

No guarantee of usefulness or problem-solving-ness... Just a conversion to 7.x.

Also, I noticed in the docs that we also have this: https://www.php.net/manual/en/ini.core.php#ini.serialize-precision

That is, serialize_precision is a thing, and maybe we need to care about it.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.