Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
lock() currently still uses the lock_backends variable but we now have the lock service available.
lock() should be updated accordingly. We might have to move the service definition to drupal_container() for this to work, though..
Comment | File | Size | Author |
---|---|---|---|
#38 | lock-shutdown-function-1825450-38.patch | 7.26 KB | Berdir |
#34 | lock-shutdown-function-1825450-34.patch | 7.26 KB | Berdir |
#34 | lock-shutdown-function-1825450-34-interdiff.txt | 749 bytes | Berdir |
#33 | lock-shutdown-function-1825450-33.patch | 7.16 KB | Berdir |
#33 | lock-shutdown-function-1825450-33-interdiff.txt | 1.09 KB | Berdir |
Comments
Comment #1
BerdirFirst, untested patch.
I think we should also move the lock documentation out of bootstrap.inc and to the lock interface, similar to how it's now done for cache API.
Comment #3
BerdirThis should be better.
Comment #5
BerdirEntityFormTest failure looks unrelated, opened #1825568: Random test failure in Drupal\system\Tests\Entity\EntityFormTest for that.
Comment #6
BerdirAdded a __destruct() to call releaseAll() to the database backend.
I think we weren't doing this before to be able to use our shutdown wrapper that catches exceptions but I think we're already using __destruct() in other services.
Comment #7
BerdirThis is running for 1h20 now, I think I produced a loop.
Comment #9
BerdirOk, so it isn't a loop but it results in tons of apache segmentation faults. How the ... ?
Comment #10
znerol CreditAttribution: znerol commentedRebase onto current head.
Comment #11
znerol CreditAttribution: znerol commentedComment #13
znerol CreditAttribution: znerol commentedThe good news: I got the following stack trace:
Always immediately followed by that one:
The bad news: Even after commenting out
$this->releaseAll();
in the destructor, the patch caused havoc all over the place. I can reproduce the segfaults and on the first glance it seems to me, that they are caused by a strange interaction between lock and cache.Comment #14
znerol CreditAttribution: znerol commentedAttached is output from apache error.log and a patch producing the messages in the log while running the system test group. I did not fully digest the data but it seems that the segmentation fault often is preceeded by something like
lock release end: theme_registry:runtime:bartik:cache
.Comment #15
BerdirYes, __destruct()'s within the DIC seem to be evil. Let's try with that releaseAll() commented out, that did pass the book test locally.
Comment #17
BerdirHere is a patch that uses the terminator code from @katbailey. The lock test isn't going to work yet, because the test does an exit() and expects the lock to be released in a shutdown function, which doesn't work.
For reference, it does work fine when removing the exit and allowing the terminate event to run.
Two options that I can see:
- Make sure that the kernel is always terminated, e.g. by using a shutdown function.
- Use something else, at least for lock. A direct shutdown function for example, as we're doing it right now.
Comment #19
BerdirOk, as suggested by @catch, I've just moved the shutdown function into DatabaseLockBackend.
Comment #21
BerdirThis should fix the DrupalUnitTestBase related failures, not sure about the others yet.
Nice to see how all the DUTB overrides are moving into the container slowly...
Comment #23
BerdirUps, that was wrong, this should be better.
Comment #25
BerdirOk, had to reset the statics before the new empty test container is created because ThemeRegistry needs the lock service to shut down. We need to convert that stuff to a service, similar to views data service, then this can be removed again.
The reason that this only happened in the simple test tests is that new theme functions where used that it tries to persist, which does not happen in CLI/manual test runs (although it can probably be reproduced there if you manually clear the cache first).
Comment #26
dawehnerWe seem to convert each procedural functions to just use the container, so I guess we should do that in a follow-up.
The patch looks really similar to #1880730-1: register a lock factory in the container though it actually works :)
Comment #27
catchCommitted/pushed to 8.x, thanks!
Comment #28
catchEr not quite, need to actually finish committing before commenting. This no longer applies.
Comment #29
BerdirRe-roll proudly presented by git rebase :)
Comment #30
dawehnerLet's get it back.
Comment #32
BerdirStrange, see #1874562-36: Upgrade path broken and yet tests pass
Comment #33
BerdirOk, figured it out, was quite logical after all.
The flag site check was inverted but due to lucky coincidences, this never blew up in the past only now that we need the lock service during variable_initialize(). Fixing that resulted in the mentioned notice.
Between setting the upgraded flag and rebuilding the system data, we never did a web requested, so never called refreshVariables() automatically. So global $conf was completely empty when rebuilding module data, which resulted in drupal_get_profile() returning the default value (standard), which added standard instead of minimal to the files list.
All I had to do fix that was to call refreshVariables() myself after enabling the flag...
This will hopefully pass.
Comment #34
BerdirSmall improvement to the comment so that the "No" does not imply that we have to negate the variable.
Comment #35
dawehnerThank you for that small last bit!
Comment #36
catch#34: lock-shutdown-function-1825450-34.patch queued for re-testing.
Comment #38
BerdirWhy does this always conflict. We need an automated git rebase bot because there were no conflicts with that...
Comment #39
dawehnerSo :)
We maybe should think about whether a direct shutdown function is still the way to go in Durpal 8, as it couples the lock code with some bootstrap.inc
What about following the path you started in earlier versions of the patch using symfony events? But sure this should be a follow up.
Comment #40
BerdirThat doesn't work for this, as terminate() is not called reliably, see #17 and #19.
Comment #41
catchThanks! Committed/pushed to 8.x.