Closed (fixed)
Project:
CiviCRM Entity
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Mar 2022 at 21:03 UTC
Updated:
20 Dec 2022 at 20:39 UTC
Jump to comment: Most recent
Comments
Comment #2
markusa commentedThis was an attempt: https://github.com/eileenmcnaughton/civicrm_entity/pull/364
But really that would require a Drupal cache clear at the right time.
We need a hook that fires when a component is disabled.
Comment #3
markusa commentedIf the issue is disabling the extension .. could clear some caches with this hook
https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_disable/
I don't see anything for when a component is disabled.
Comment #4
karingI've got some more time now to detail this ->
Steps to reproduce:
1. On D9.3.6, CiviCRM 5.46 enable CiviGrant (to do a small WFC demo) and enable CiviCRM Entity (to create a view with Activities)
2. upgrade CiviCRM beyond 5.47 -> I went to 5.48.alpha1
3. disable civigrant extension [perhaps you've decided to no longer want grant functionality]
4. observe WSOD on every single page
5. drush cr also fails
6. backtrace (fished out of watchdog):
Comment #5
karingWe actually now suspect that any site (even those with CiviGrant component disabled by default) upgraded it to 5.47+ will get to the same WSOD on every page.
The difference between disabled extensions and disabled components is that civicrm_api3("Grant", etc) is still available even when the component is disabled.
Bumping this to Critical.
Comment #6
karingBack to status = major as it may only affect sites who have CE and civigrant enabled at the time of migrating across 5.47
https://chat.civicrm.org/civicrm/pl/a6grg67u3pnyikcjgykqporggh
Comment #7
markusa commentedFor people not using Drupal integration for CiviGrant, until some better solution exists, Can do this:
1) Comment out this section here for civicrm_grant entity: https://github.com/eileenmcnaughton/civicrm_entity/blob/8.x-3.x/src/Supp... .. lines 325-336
2) Clear Drupal caches
3) Upgrade CiviCRM
4) Optionally uncomment that section, and clear Drupal caches again
If using Grant in Views or other Drupal integration, one could try this, but not sure how Drupal will react to an entity type disappearing and config depending on it.
Comment #8
markusa commentedFurther testing has revealed, that CiviCRM Entity as it is in 3.1, will be ok upgrading to 5.47
Caveat, it appears that if Redis, and likely if Memcache are used, this error can happen.
Most likely option now is to patch CiviGrant extension in 5.47
drupal_flush_all_caches() needs be called if CMS=Drupal8 (D8+) or cache_clear_all() if CMS=Drupal (D7-)
redis and memcache should have hooks that clear their respective caches when those functions are ran.
I think still D7 module would need a similar patch to what was done in the D9 module. Will post when that is done and release made.
Comment #9
markusa commentedBackported fix for D7 version, that was in 8.x-3.1
https://www.drupal.org/project/civicrm_entity/releases/7.x-2.4
Comment #10
karingI don't think this is resolved completely though - we can't be the only providers using redis or other forms of caching.
Comment #11
markusa commentedWell .. AFAIK there is no way to react to a CiviCRM extension being disabled / enabled in a Drupal module.
This likely needs a Core patch to fix.
hook_civicrm_disable() is only called in the extension that is disabled, not all modules. So in CiviGrant, this hook should be added or augmented to:
drupal_flush_all_caches() needs be called if CMS=Drupal8 (D8+) or cache_clear_all() if CMS=Drupal (D7-) on extension install/enable/disable
If there is some programmatic method we can use, then we'll definitely do it.
For now people should:
Disable redis or memcache
Disable CiviGrant extension
Re-enable redis or memcache
Comment #12
markusa commentedComment #13
markusa commentedAnother idea would be a Core patch that would dispatch a Symfony event when an extension is disabled, then have a D9 event subscriber that could listen for that and clear caches.
This would not work with Drupal 7 though, because no Symfony there.
Drupal needs a "needs patch upstream" status for their issue queue
Comment #14
elisseck commentedRe: #6 - Not sure if this falls into a weird edge case or not but I just ran into this issue without CiviGrant enabled (I do not believe this site has ever used CiviGrant).
- Drupal 9.4.1
- CiviCRM 5.49.5
CiviCRM Entity code existed but was not previously installed. Click "Install" in the GUI leads to the WSOD on every page until files are removed or the SupportedEntites code is commented out for CiviGrant as outlined above. The patch in #7 does work fine in this case since the organization is not using CiviGrant.
Comment #15
markusa commentedAre you using CiviCRM Entity 3.3?
Comment #16
elisseck commented@markusa yes, this is required as "drupal/civicrm_entity": "^3.3". Not sure why that site is acting up yet but thought it might be useful to know and I can dig into the specifics if it would help you.
I could not, however, reproduce this morning with a clean site i.e. something like this appears to work fine:
`civibuild create d9clean --type drupal9-clean --url http://d9clean.localhost --civi-ver master`
`composer require drupal/civicrm_entity`
`drush en -y civicrm_entity`
Comment #17
markusa commentedIt would be interesting to see if this condition continues to manifest in 5.51
I had tested the patch by upgrading from 5.45 to 5.48 with CiviCRM Entity enabled
and enabling / disabling the CiviGrant extension .. and it seemed to go fine in my tests.
I did not test trying to install CE into a new site with Civi 5.48 or 5.49 instance fresh. But you say it works fine on a new, clean site. Since you are using master branch, its possible something in Civi has been updated.
For it to error on install, Civi 'entity' api 'get' action must say that Grant is an available entity, but the other necessary files that provide that entity type must not be discoverable. I need a better way to tell.
IDK if upgrading your site from 5.49 to 5.51 is an option for you.
Comment #18
elisseck commentedAh the fail condition is good info I can check what's going on there, and i'll let you know what happens when this site gets upgraded. I think they'll get the August release unless there is a security release in the next couple weeks.
Comment #19
elisseck commented@markusa well I was pretty wrong about the upgrade schedule for this particular site for a number of reasons, but I am confirming that this issue went away i.e. I can remove the patch from #7 and not WSOD the site any longer once CiviCRM was upgraded to 5.52.3.
Thanks! It's possible this could be closed for now if the expectation is that people are up-to-date.
Comment #20
markusa commentedFor future searchers .. we also found that its better to either have the CiviGrant enabled or disabled.
If upgrading a version where CiviGrant is already an extension, better to have installed, or uninstalled, but not "disabled"