Problem/Motivation
Site maintainers want to load the /admin/reports/status page while building & upgrading their site.
Currently with 9.0.x if a module or theme is found which does not have the expected "core_version_requirement" value in its .info.yml file the /admin/reports/status, admin/module, admin/appearce page and probably others will crash with this error (for the module "restui"):
Drupal\Core\Extension\InfoParserException: The 'core_version_requirement' key must be present in modules/contrib/restui/restui.info.yml in Drupal\Core\Extension\InfoParserDynamic->parse() (line 73 of core/lib/Drupal/Core/Extension/InfoParserDynamic.php).
The problem will happen if visit /admin/modules
other clear caches. After this happens many pages will have the problem.
Proposed resolution
Fix the error so that the /admin/reports/status page loads and other page load and just displays an error message about the incompatible module.
Remaining tasks
- Identify the root cause of the problem.
- Provide test coverage that illustrates the problem.
- Provide a fix for the problem.
User interface changes
TBD
API changes
TBD? Shouldn't be necessary.
Data model changes
TBD? Shouldn't be necessary.
Release notes snippet
n/a?
Comment | File | Size | Author |
---|---|---|---|
#43 | core_version_requirement-3123537-43.patch | 12.25 KB | kkalashnikov |
#36 | 3123537-36.patch | 13.06 KB | tedbow |
#36 | interdiff-29-36.txt | 2.06 KB | tedbow |
#30 | 3123537.25_29.interdiff.txt | 8.42 KB | dww |
#29 | 3123537-29.patch | 13.06 KB | tedbow |
Comments
Comment #2
DamienMcKennaIt's related to #3119822: InfoParserDynamic will throw a different exception the 2nd time it is called with bad 'core_version_requirement' value but the fix there doesn't resolve the problem.
Comment #3
DamienMcKennaSeems like this might be by design? It just seems like it shouldn't WSOD, just present the fact that the module cannot be installed?
Comment #4
BerdirAt least the other way round (trying a module that needs at least 8.7.7 on a lower version) is by design, maybe this could be handled better.
This is a side effect of a recent issue to verify that all installed modules should be compatible but it should maybe not fail on those that aren't installed?
Comment #5
xjmSo this behavior is by design. That said, it's worth discussing whether there are downsides to that choice. Marking as a task to discuss whether to change how this is handled since it's not 100% a bug, but promoting to major and marking as a beta target given the impact and importance.
Comment #6
tedbowSo this by design but the title here is not completely accurate.
It is not that it found an incompatible module but the key that would tell Drupal whether it is compatible or not was not found.
this was done intentionally in #3105701: Do not allow core: 9.x in info.yml files
So you get a similar error as if you missed the
type
orname
key.An incompatible module would be an info file with
core_version_requirement: ^8.8
orcore_version_requirement: ^9.1
We could change this because we don't the bug in #2917600: update_fix_compatibility() puts sites into unrecoverable state. Then if
core_version_requirement
is missing we could just setcore_incompatible = FALSE
like we do if we havecore_version_requirement: ^8.8
.Comment #7
DamienMcKennaThank you for the explanation, Ted, from the site builder's perspective I think that would be a better solution.
Comment #8
BerdirThere's also a related problem that won't be easy to fix because we would need to backport to 8.7.
page_manager requires 8.8 and removed the core requirement key from test modules. metatag still supports 8.7 but has require-dev for page_manager, that breaks completely on 8.7 even though only a single test actually needs to install page_manager: https://www.drupal.org/pift-ci-job/1633485
Comment #9
tedbowcore: 9.x
because that is very rare and if we throw an error then module developers won't make this mistake.core_version_requirement
.We recommend making sure your modules are compatible before you update core to D9(I know not everybody will find/follow these instructions)
Here is what I mean. If someone a wrote blog post with these instructions:
although the above instructions I don't think would be recommended, with change I suggested is possible(not necessarily recommended) in #6 and the changes we made to add error messages for incompatible modules in #2917600: update_fix_compatibility() puts sites into unrecoverable state it would be possible.
Technically this would be possible already if all of your modules had at least
core_version_requirment: ^8.8
but I think that would be an unlikely scenario.My point is, I think we should be very careful about a change like this and think about the unintended effects. It might still be worth making but it will have other effects.
If we don't make the change here and tried to the steps I outlined above in step 4 "Visit update.php" then you would get the hard exception about
core_version_requirement
being missing, you see this if error reporting are on.If we don't make this change it is much more convenient to upgrade your modules before you update core.
If we make this change it may actually be more convenient to upgrade your modules after you update core.
If it is more convenient even if we document that you shouldn't do this it may become the default way people upgrade.
There might be other effects I am not thinking of also.
Comment #10
catchAnother way to trigger this would presumably be installing 9.0.0 and downloading a contrib module that's outdated (or is it different for uninstalled modules?), or downgrading an installed module for some reason.
I think if we want to explicitly prevent people from doing this, we should introduce a check in system_requirements() update to check all installed extensions and that they're compatible prior to allowing updates to be run, similar to what we did in #3098475: Add more strict checking of hook_update_last_removed() and better explanation.
Comment #11
cilefen CreditAttribution: cilefen as a volunteer commentedComment #12
pingwin4egCan we "relax" the error at least for uninstalled modules?
I see the WSOD on all pages of the site, not only on the status report. Also
drush cr
can't complete because of the exception.The white screen has only a "The website encountered an unexpected error. Please try again later." message.
Error reporting is set to "None" at /admin/config/development/logging and not overridden anywhere - this is a new clean installation (from web ui) of the latest D9-dev with the standard profile. But PHP's
error_reporting = E_ALL
.Comment #13
tedbowre #10
We actually did this in #2917600: update_fix_compatibility() puts sites into unrecoverable state
But as I said #6
re
No if
core_version_requirement
is not found it doesn't matter if the module is uninstalled or not it will throw this hard error.Comment #14
tedbowI working on patch.
Basically
In
\Drupal\Core\Extension\InfoParserDynamic::parse()
throw hard error ifcore
is set to anything butcore: 8.x
. This is existing behaviorcore
orcore_version_requirment
is set. Exception recommends settingcore_version_requirment
, this exception message is existing. The only difference would be that ifcore: 8.x
is set there would be no exceptioncore: 8.x
will evaluate to$parsed_info['core_incompatible'] === TRUE
.Then the existing logic in
system_requirements()
that we added #2917600: update_fix_compatibility() puts sites into unrecoverable state will stop updates if you just havecore: 8.x
andcore_version_requirement
is not set. It will display an error message and link to Troubleshooting database updates. There are no changes needed for this.Comment #15
xjm@pingwin4eg Maybe your error reporting is not set at /admin/config/development/logging to show errors and warnings?
Edit: Or you need to add this to
settings.php
since you probably can't use the UI right now:So there are two different audiences here:
update.php
, or who has already tried to upgrade but has incompatible modules in the codebase for whatever other reason. This might happen particularly if installed modules were all updated to D9-ready versions, but uninstalled modules were not.For the module developer, they need the specific, clear exception in order to fix the module. If the module is installed but is not D9-compatible, everything is broken and we should not allow the site to run until the module is fixed, because this could lead to all sorts of data integrity problems. If the module's not installed, the current behavior is also helpful to them. (The alternative would be that the module would just silently not show up in the module list, without them getting any debugging information as to why.)
For the site owner, the specific error message is not helpful to them. What they need to know is that they have a module that's not compatible with D9 in the codebase, so they need to either get rid of it or go back to their D8 codebase. We still should be failing hard if the module is installed, because again, data integrity problems etc. However, if the module's not installed, they probably don't want their site on fire for that.
So the question is how to bridge those two audiences for the two respective scenarios.
Comment #16
DamienMcKennaIn my scenario I copied a bunch of contrib modules from a local D8 install to a D9 install with the intention of seeing which of them could be installed, i.e. which had the appropriate changes to their info.yml files. I wasn't expecting to get a WSOD as a few weeks previously it had worked fine and just blocked my ability to install incompatible modules.
Comment #17
tedbowOk here is a patch I worked on this before I chatted with @xjm
It implements what suggested in #14
Re #16
It would solve this problem. You would not be able to install the modules. You would see this message
If you went to update.php or admin/reports/status and you had any of these modules enabled(b/c they previously had a valid
core_version_requirement
then you would see message about the modules being installed but incompatibleYou can see the message screenshots in the summary of #2917600: update_fix_compatibility() puts sites into unrecoverable state
Comment #18
xjmBut that message would only show up on the status report or
update.php
, right? What happens on the extension page in that scenario? The site is effectively broken when incompatible modules are enabled, including ones missing thecore_version_requirement
key.Comment #19
xjmSo the effect from this is that if
core: 8.x
is present butcore_version_requirement
isn't, the error message for the developer is no longer displayed anywhere. So how does the developer then get the information that that key is missing and that's why the module's not compatible?Comment #20
Berdir> So how does the developer then get the information that that key is missing and that's why the module's not compatible?
They won't be able to install the module?
Comment #21
tedbowre #16
Yes they wouldn't see anything on the extension page.
But also this is true for modules that are enabled and have
core_version_requirement: ^8.8
. Since we addedcore_version_requirement
in 8.7.7 it probably means there are tons of modules that are using it to denote compatibility with specific versions of 8. So now in 9.0.x they would see no message about these modules except if they visit update.php or the status report.We have related existing problems such as a module could have been updated and the new version has higher requirement for php. If they don't go to update.php or status report they won't know that.
I could think of a few ways to solve this problem.
core_incompatible === TRUE
. Add a message with a link to the status report where they would see specific modules\Drupal\system\SystemManager::listRequirements()
and check if there requirements we set in system_requirements() for incompatible modules, php version or missing modules are set. If so message and link to status reporthook_requirements()
,requirements_context
. If any requirements set\Drupal\system\SystemManager::REQUIREMENT_CONTEXT_MODULES
then show a message with a link to the status report.Update system_requirement() to add this context for incompatible modules, missing modules or php version problems.
We could the same with themes on the themes page
Here are 3 diffs from #17 for these ideas. Not including the full patches because theren't test anyways and they are rough ideas
Comment #22
dwwEither the scope of this issue needs to change to not just be about /admin/reports/status or we should open a follow-up to discuss what appears on the extension page. I'll leave that decision to the scope wranglers. I basically never get it right.
That said, the module page now has the 'Compatible' vs. 'Not compatible' details element on each project. So if we want to put more stuff on the extension page about incompatibilities such as PHP version and whatnot, we have plumbing in place to handle it.
See #23.Comment #23
dwwSorry, brain fart. It's the available updates report that has the Compatible vs. Not compatible details I was thinking of. The modules page already has a collapsed details element for each project, and that already has logic to show you things like PHP incompatibility. I crossed my wires. I had meant to potentially start having the available updates report show us more of those kinds of compatibility problems, inspired by the checks we already have on the modules (extend) page...
Comment #24
tedbowCurrently on many pages will WSOD because of this error if you clear cache or if the page for some reason resets the extension caches so I think this issue should handle the problem.
So if you
drush cr
or visitadmin/config/development/performance
and clear caches then many will stop working on all pages after that.I assume we want to fix that and not just on the /admin/report/status page.
Updating the Issue Summary to reflect the problem is on
With the current problem where a module is missing
core_requirement
, for both installed and uninstalled modules you won't actually see this message because the form won't load.Don't throw the exception in
\Drupal\Core\Extension\InfoParserDynamic::parse()
ifcore_version_requirements
is missing. Instead put an error on/admin/modules
if we find a module that is not compatible and is enabled. Any module withoutcore_version_requirement
will be incompatible but also any module that hascore_version_requirement
that is not a compatible constraint. In error we link to theadmin/report/status
so they can see the list of modules that aren't compatible.We should do the same with /admin/appearance
Comment #25
tedbowHere is patch that
\Drupal\Core\Extension\InfoParserDynamic::parse()
ifcore_version_requirement
is not set.Practical effects this has
core_version_requirement
or other reasons). These messages are existingcore_version_requirement
on module/theme listing page, as long as they havecore: 8.x
but they won't be able to be enable and they will have a message that says they aren't compatible. This message is not new.
modules with <code>core
set to anything other than 8.x will still throw an errorComment #26
tedbowComment #27
dwwI like where this is headed, thanks! A few concerns:
Shouldn't this become
elseif()
instead ofelse { if() }
?$this->t()
, right?A) Needs punctuation after 'themes'. Either a comma, or perhaps a whole new sentence.
B) The whole thing should end with a period.
C) I think I remember some UI guidelines for core that we don't say "Please". ;) Maybe:
"There are errors with your themes. Visit the {link} to learn more."
(or something).
This also needs help, as above.
Slightly confusing since it looks like the first array has
core_version_requirement
. I should look at the whole test in context. Probably nothing to fix here, just flagging it. ;)This summary doesn't parse. Missing some words at the end (or something).
Comment #28
dwwSince this is RC-blocking, and I don't want to hold up progress, this fixes all of #27 except point 5 for which there's nothing to fix. ;)
Comment #29
tedbowI didn't see @dww patch when did my patch here. My patch is the same except for slight different wording for #27.3 where I add "installed" because it is only if the extension is installed and .6. Also added additional test coverage
@dww thanks for the review
Used
core: 8.x
and nocore_version_requirement
we should have this new test case.Also add test coverage for the message on the module and theme admin pages.
Comment #30
dwwOh well, bummer for duplicated effort. Glad you arrived at almost identical changes. ;)
However, that interdiff doesn't look right. That's only including the new tests. Here's the actual interdiff between #25 and #29.
Also attaching an interdiff between #28 and #29 FWIW.
Cheers,
-Derek
Comment #32
dwwRandom fail:
Requeued.
Comment #33
tim.plunkettAt first it seemed suspect to not have an
else
case anymore, but when looked at in the larger context of the rest of the function, it makes sense.Reread all the issue comments, worked through the coverage locally, and everything checks out. Thanks to both @dww and @tedbow for pushing this one through!
Comment #34
xjmI happened to have the
layout_library
module sitting in a local repo'smodules/
for I guess the past two years. Tried to install Drupal, got:That seemed as good an opportunity as any to manually test this change (and and a good example of why we should make it). I applied #29 and re-ran the quickstart command, and Drupal installed. So that's some manual testing confirmation.
Comment #35
catchnit: incompatitable.
It's consistent so just a typo, fixable on commit.
Comment #36
tedbow#35
🤦♂️
I joked that in #2313917: Core version key in module's .info.yml doesn't respect core semantic versioning that at least I would learn to spell incompatible.
Today I learned that at some point I accidentally added "incompatitable" to my phpstorm application dictionary 😥
Comment #37
dwwRe: #35 / #36: Heh, whoops. I think "incompatitable" is in my mental dictionary now, too. ;) Sorry I missed it earlier.
+1 that #36 is still RTBC. Interdiff looks good. Bot is happy.
Thanks/sorry,
-Derek
Comment #39
catchCommitted/pushed to 9.1.x and cherry-picked to 9.0.x, thanks!
Comment #41
xjmAre we backporting this to 8.9.x? The error is not likely to happen on D8, but we should keep the logic the same.
Comment #42
kkalashnikov CreditAttribution: kkalashnikov at Srijan | A Material+ Company for Drupal India Association commentedComment #43
kkalashnikov CreditAttribution: kkalashnikov at Srijan | A Material+ Company for Drupal India Association commented@xjm, This is the patch for 8.9
Comment #44
kkalashnikov CreditAttribution: kkalashnikov at Srijan | A Material+ Company for Drupal India Association commentedComment #45
daffie CreditAttribution: daffie commentedPatch fails the testbot.
Comment #46
xjmUnfortunately we missed this against 8.9.x (since new APIs can't be added after the release). It's in 9.0.x though which is the critical part. Thanks!
Comment #47
xjmI typed "new APIs" in #46 because I was thinking about the statement I made earlier that 8.9 and 9.0 are supposed to have the same API and behavior. The issue is a behavior change as well as string addition, which makes it minor-only by default, and the actual WSOD is not likely to happen on D8, which reduces the priority for the backport anyway.
Our policy in general for the production branch is "if in doubt, don't backport" since there's statistically always a chance that a new fix or improvement will introduce a different regression, and our first priority is the stability of the production branch.