I have removed the reset functionality from module_load_all as "useless" which was reverted before the {system} table removal patch went in, I already complained in another issue and was told that it needs to stay in.
However, it now causes random failures all over the place. This is hardly surprising: I have not removed it because I have a penchant for removing random things but because it was broken.
This was first fixed in #140 in that issue as seen in http://drupal.org/files/interdiff-139-140.txt. That, in itself, is not enough now because theme() throws an exception with that fix. #1331486: Move module_invoke_*() and friends to an Extensions class has the current fix, no time to roll it now.
Comment | File | Size | Author |
---|---|---|---|
#29 | drupal8.test-module-load-all.28.patch | 5.26 KB | sun |
#27 | drupal8.test-module-load-all.26.patch | 4.87 KB | sun |
#25 | drupal8.test-module-load-all.25.patch | 5.17 KB | sun |
#22 | switch-teardown-order.patch | 6.04 KB | Berdir |
#19 | drupal8.test-module-load-all.19.patch | 1.83 KB | sun |
Comments
Comment #1
chx CreditAttribution: chx commentedYou hit the following when the cache happens not to be warm when your test runs its tearDown (hence the random aspect):
I have seen this in totally unrelated patches as well, it's not because the extensions patch happens to move things.
Comment #2
chx CreditAttribution: chx commentedand change the reset calls in tearDowns from FALSE, TRUE to FALSE, TRUE, TRUE.
Comment #3
chx CreditAttribution: chx commentedFinally, I assign these issues (there are so far six at least) to sun not because I do not appreciate his work on the {system} removal -- I admit the code became cleaner -- but because he did not talk to anyone about what the possible consequences are about reverting parts of a patch this complicated. And, I was too tired of fighting to throughly review a 80KB interdiff...
Comment #4
chx CreditAttribution: chx commentedComment #6
chx CreditAttribution: chx commentedComment #8
sunAny call to system_list() causes this chain of errors. The patch here attempts to touch the symptom but not the cause.
The real question you need to ask is this:
Why is system_list() still querying
simpletest764204key_value
instead ofkey_value
when being invoked from tearDown(), after the environment has been reset to the parent site/test runner?Clearly, system_list() is operating on the wrong container.
Comment #9
sunMore context.
Comment #11
sun#9: drupal8.test-module-load-all.9.patch queued for re-testing.
Comment #12
sun#9 failed with "Repository checkout: failed to checkout from [git://git.drupal.org/project/drupal.git]." - not related to the actual patch.
Also, I apologize for my snarky reply. It's really hard to resist that when you're continuously accused to have removed a "proper bug fix" that gets repeated in "meh.patch" files by people who obviously know it better.
Comment #13
chx CreditAttribution: chx commentedThat's another reason I am assigning to you -- because you do know better. Thanks for the clearer fix.
Comment #15
chx CreditAttribution: chx commented#9: drupal8.test-module-load-all.9.patch queued for re-testing.
Edit: oh, the irony: this failed because of another random testbot failure.
Comment #16
BerdirFollowing. #1764474: Make Cache interface and backends use the DIC exposed this problem in a consistent way and I had to fix it there too. Did fix it in a slightly different way, though by moving the drupal_container() restore up, not the module reset calls down, because we also need the original container back before drupal_static_reset() is called.
The reason for that is that drupal_static_reset() can trigger a __destruct() of ThemeRegistry() which in turn ends up calling system_list().
Comment #17
sunIf that happens, then it must happen in the test environment (not in the parent site/test runner environment).
I quickly checked your patch over there, and it breaks exactly that.
TBH, those magic destructors are a PITA to deal with though... I can perfectly see how a drupal_static_reset() will trigger __destruct() methods that will immediately call into other functions and re-prime statics and caches. :(
I'm not sure how to combat that in a reliable, once-for-all/-eternity way.
Comment #18
sunHrm. Speaking of, a pretty straightforward solution might be this insanity:
Inline comments would have to clarify, of course. ;)
Comment #19
sunImplements #18.
Comment #21
BerdirOk, as I figured out while working on #1764474: Make Cache interface and backends use the DIC, I think I know what the actual problem is here.
Right now, this is the order of things:
1. Remove test tables.
2. Restore original database connection
3. Clear caches.
I *think* we need to change it to this.
1. Clear caches
2. Remove test tables.
3. Restore original database connection.
This allows to execute the cache clears within the original environment. They can do whatever they please to the test database, we don't care. The static caches should be cleared anyway. It might be possible that we need to do certain clears again in the original environment, we'll see. The more stuff we move into the container and can just get back, the fewer of that should be necessary...
Am I missing something? ;)
Comment #22
BerdirHm. Tried it. For web tests, it seems to work nicely, but unit tests don't like it and seem to get stuck?
Anyway, for testing purposes, here is a patch that tries this and for now duplicates the tearDown() method of unit tests to keep the old behavior there.
Comment #24
webchickWe're over thresholds. Can I commit #9 so we can get this out of the criticals queue and work on a more optimal fix in a normal task?
Comment #25
sun@Berdir: Isn't #19 implementing exactly what you descibe in #21?
1) Clears caches
2) Removes database and files and restores database connection
3) Clears caches again
4) Restores container
The only remaining problem with #19 is that WebTestBase::tearDown() drops all tables before calling into TestBase::tearDown().
Thus, the only thing we would need to "repeat" is the first drupal_static_reset().
However, since I'm moving the removal of tables in #1774388: Unit Tests Remastered™ anyway into TestBase::tearDown() already, I'm going to merge that change into this patch instead.
Comment #27
sunSorry, that was merged too quickly -- forgot to move the drupal_static_reset() above the removal of db tables.
Also realized that language() is not properly reset.
Comment #29
sunOdd, I don't really see why the patch shouldn't apply against latest HEAD -- re-rolled.
Comment #30
sunI think this is ready to fly.
Comment #31
sunClarifying issue title. I'm also marking this RTBC, even though the patch to commit is my own, but this is a critical issue that is blocking other patches, and part of the changes were rtbc'ed earlier already.
Comment #32
sunComment #33
chx CreditAttribution: chx commentedI think this is good to go, yes. It'd be superb hard to test this and having unit tests clean up their tables is good.
Comment #34
webchickCool, thanks for the verification, chx.
Committed and pushed to 8.x. Bomp. Bomp. Bomp. A critical bites the dust-AH!