from #1879774: Catch plugin exceptions for invalid views display plugins, reported by oadaeh:
I did a brand new install with D8 code downloaded less than an hour ago (which means the committed changes from this issue are in it) into a new database, and then performed the following steps:
Created a view (of users) with a block display
Placed that block in a region
Deleted the view
Displayed or refreshed a page that has the block on it
I get a WSOD. (When I did this last night, I was also getting an error message, but I'm not getting it now, so I can't post it).I get this from Apache:
PHP Fatal error: Call to a member function access() on a non-object in /.../core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php on line 56If I delete the associated .yml file, everything is fine again.
Beta phase evaluation
| Issue category | Task because we are just asking for tests. |
|---|---|
| Issue priority | Major because its a core feature coverage issue |
| Comment | File | Size | Author |
|---|---|---|---|
| #23 | vdc-2018493-23.patch | 15.87 KB | hussainweb |
| #23 | vdc-2018493-interdiff-21-23.txt | 1.88 KB | hussainweb |
| #21 | vdc-2018493-21.patch | 16 KB | hussainweb |
| #21 | vdc-2018493-interdiff-20-21.txt | 706 bytes | hussainweb |
| #20 | vdc-2018493-20.patch | 15.99 KB | hussainweb |
Comments
Comment #1
catchComment #2
dawehnerThis is indeed annoying and there are multiple problems here, but this at least fixes the UI and
Comment #4
damiankloip commented#2: vdc-2018493-2.patch queued for re-testing.
I don't believe all those failures.
Comment #6
damiankloip commentedThis is a nice start, basically the same approach I was thinking of. Another big problem is also when a view is disabled. Because the derivative fetcher only gets enabled views, I think we might have to have something in Block::getPlugin() to deal with this, as is a view is disabled we defintely want to keep the actual block. If we do something like this in getPlugin() the good is that it will not show the block and will be removed from the block admin page, and will return when a view is enabled again. Either that or we let all views regardless of status in the derivatives, and then worry about signifying the view is disabled in the UI somehow? not sure.
Added a test for the disabled view case, and the changes to getPlugin(), with a todo with how to handle the caught exception - This is a similar issue to the broken displays plugin handling.
Comment #7
damiankloip commentedI spoke to Tim, we should definitely be encapsulating any of the exception logic in the plugin bag, it's things like this that we are using plugin bags for I guess. But how do we deal with the exception logic in BlockPluginBag and it's module stuff? Just remove it?
Comment #9
dawehnerThis is green now.
Comment #10
olli commentedOops
Comment #11
jghyde commentedI just tested the user story in the topic opener from damiankloip with the latest git pull of 8.x. after creating view of users, adding the Views:users block to sidebar right, deleting view and viewing page as noted, no WSOD and the log files are clear.
MAMP, php 5.4
Comment #12
dawehnerThere we go.
Comment #13
R.Hendel commentedI applied patch #12 against a freshly installed current 8.x
- I created a view with displays newest five items in a block
- I created a view with displays newest users in a block
- I placed both blocks in header region and reloaded homepage. Both blocks were there.
- I deleted view with newest five items and reloaded homepage. No errors and only users-block was there.
- I deleted view with newest users and reloaded homepage. No errors and no block was there.
So everything is fine.
Thanks for the patch, @dawehner!
Comment #14
catchThat's completely hiding all errors now, at least watchdog_exception()?
Comment #15
sdboyer commented@dawehner pointed me to this to make sure that it was kosher from a SCOTCH perspective. it actually kinda isn't, but the code that's already in isn't good either.
we don't ever want other systems acting on behalf blocks system and assuming something about its storage mechanism - this is (part of) why we're doing #2022897: Shift responsibility for creating unique config id/machine name off of (views) block plugins and onto BlockFormController. doing so precludes the possibility that block plugin instances might be placed & managed by any system other than core's block.module - and we're already doing exactly that in princess.
HOWEVER, that's no reason to block the fixing of this critical bug, especially because the code is no more broken in that respect by this patch than it was before. so, a followup is just fine. and here it is: #2031859: Invoke an event[s] when a plugin ID disappears.
Comment #16
dawehnerThis is the same patch as #12, but I want to know whether it fails. If it does not, I would vote to NOT do this change in this issue.
Comment #18
dawehnerRerolled.
Comment #20
hussainwebThere is a conflict from changes in #2031519: Deleting a view does not empty it's object cache with this function. This causes installation to fail. I am rerolling a patch to fix this and first test manually. The installation succeeds after my changes. I will just run the tests locally and see if I can make some progress.
Comment #21
hussainwebFound the problem that caused all those warnings and exceptions. It was a very simple change, as shown in interdiff.
Now, lets see what testbots have to say.
Comment #23
hussainwebI am fixing some of the errors with this patch. These errors were all due to incorrect usage of StorageController::load() method in the test. It was being used with the syntax of loadMultiple(), which threw all those errors.
The error I could not fix yet was:
I am not entirely sure how to go about fixing it. The error is due to DisplayBlockTest.php, line 118 (after patch):
I got a similar error during manual testing when I deleted the view, but it was "fixed" after earlier fixes. I could not repeat it during manual testing in any case. I will post again if I find something. Meanwhile, I hope this analysis is useful.
Comment #25
dawehnerIt seems to be basically a duplicate of #2031859: Invoke an event[s] when a plugin ID disappears
Comment #26
hussainwebI just skimmed through the patch in #2031859: Invoke an event[s] when a plugin ID disappears and it looks like it might fix the problem in this issue. However, I think we could definitely use tests written in this issue. I will try out the patch there (which seems to be RTBC'd) and do a test for the problem in this issue.
Comment #27
catchComment #28
catchI''ve bumped #2031859: Invoke an event[s] when a plugin ID disappears to critical. Moving this to major for tests. If this ends up not being a duplicate (apart from the tests), please bump it back to critical.
Comment #28.0
catchMve issue link
Comment #29
jibran23: vdc-2018493-23.patch queued for re-testing.
Comment #31
metzlerd commentedTriage Notes:
Comment #32
xjm(Saving proposed issue credit for discussion and triage participants at LA.)
Comment #46
quietone commentedI tested on Drupal 11.x, standard install, using the steps in the issue summary. I was not able to reproduce the problem. Presumably because the block is deleted when the view is deleted.