Problem/Motivation
Rules incompatibility with other modules suspected. If Rules and Domain module suite coexist, the site crashes on some pages, specifically on user profile view or edit pages. If you attempt to login, this condition occurs, but the login actually happens.
The errors displayed on the screen are of this kind:
Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in C:\Users\xxx\Sites\acquia\sitename\web\core\lib\Drupal\Core\Routing\CompiledRoute.php on line 162 (although the memory limit had been increased dramatically)
No error logged in dblog.
If either Rules or Domain Source module is uninstalled the error is no more.
I am not sure which module causes the issue, Rules or Domain. Opening it here hoping for expert assignment.
Steps to reproduce
- In acquia desktop, create composer project, install drupal, then setup the site.
- Enable a few core modules: Layout builder, Languages in particular
- Install Rules
- Modify hosts file to point mobile.sitename.dd to the same ip address as sitename.dd
- Modify vhosts.conf to add mobile.sitename.dd to Apache vhosts
- Configure trusted hosts in settings.php
- Install Domain suite modules one by one, test view profile page. After installing Domain source submodule, the site will crash as described.
- Uninstall either one module - no error, the site functions.
- Reinstall the module - crash.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | rules.site_.context.error_.txt | 19.17 KB | eugeneak |
Comments
Comment #2
eugeneak commentedComment #3
tr commentedCan you reproduce this on simplytest.me, without all those specialized setup conditions? Does it have to be Acquia? Is Layout Builder really necessary in order to reproduce this?
A memory problem means there's an infinite loop somewhere. It would be nice to know where - there should be an error in your server log. It's unlikely the crash happens in Rules if you haven't configured any rules yet.
The only place I could think of that Domain and Rules might intersect is in the global context providers
rules/src/ContextProvider/CurrentPathContext.phpandrules/src/ContextProvider/SiteContext.phpAs a quick test, you can remove those two files and see if you still have a problem. Don't just rename them - delete them or move them outside of the Drupal root directory, away from all other Drupal files. These are just plugins, so if they're not present it won't break anything, it will just remove some functionality from Rules. You might also have to remove the corresponding lines from r
ules.services.ymlwhere these services are declared ...Comment #4
eugeneak commentedI removed these files. The site is now in error in most of config or extend pages, clearing caches, running cron, etc
The website encountered an unexpected error. Please try again later.
Error: Class 'Drupal\rules\ContextProvider\CurrentPathContext' not found in Drupal\Component\DependencyInjection\Container->createService() (line 259 of core\lib\Drupal\Component\DependencyInjection\Container.php).
Drupal\Component\DependencyInjection\Container->createService(Array, 'rules.current_path_context') (Line: 173)
Drupal\Component\DependencyInjection\Container->get('rules.current_path_context') (Line: 97)
Drupal\Core\Plugin\Context\LazyContextRepository->getAvailableContexts() (Line: 137)
Drupal\Core\ParamConverter\EntityConverter->convert('1', Array, 'user', Array) (Line: 100)
Drupal\Core\ParamConverter\ParamConverterManager->convert(Array) (Line: 45)
Drupal\Core\Routing\Enhancer\ParamConversionEnhancer->enhance(Array, Object) (Line: 260)
Drupal\Core\Routing\Router->applyRouteEnhancers(Array, Object) (Line: 131)
Drupal\Core\Routing\Router->matchRequest(Object) (Line: 116)
Drupal\Core\Routing\Router->match('/user/1') (Line: 163)
Drupal\Core\Path\PathValidator->getPathAttributes('/user/1', Object, ) (Line: 122)
Drupal\Core\Path\PathValidator->getUrl('user/1', ) (Line: 89)
Drupal\Core\Path\PathValidator->getUrlIfValidWithoutAccessCheck('user/1') (Line: 424)
Drupal\Core\Url::fromInternalUri(Array, Array) (Line: 316)
Drupal\Core\Url::fromUri('internal:/user/1', Array) (Line: 218)
Drupal\Core\Url::fromUserInput('/user/1', Array) (Line: 131)
Drupal\domain_source\HttpKernel\DomainSourcePathProcessor->processOutbound('/user/1', Array, Object, Object) (Line: 108)
Drupal\Core\PathProcessor\PathProcessorManager->processOutbound('/user/1', Array, Object, Object) (Line: 389)
Drupal\Core\Routing\UrlGenerator->processPath('/user/1', Array, Object) (Line: 298)
Drupal\Core\Routing\UrlGenerator->generateFromRoute('entity.user.canonical', Array, Array, 1) (Line: 105)
Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('entity.user.canonical', Array, Array, ) (Line: 762)
Drupal\Core\Url->toString() (Line: 554)
template_preprocess_username(Array, 'username', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('username', Array) (Line: 431)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array) (Line: 875)
render(Array) (Line: 947)
Drupal\views\Plugin\views\field\EntityField->render_item(0, Array) (Line: 1167)
Drupal\views\Plugin\views\field\FieldPluginBase->advancedRender(Object) (Line: 238)
template_preprocess_views_view_field(Array, 'views_view_field', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('views_view_field', Array) (Line: 431)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array) (Line: 1746)
Drupal\views\Plugin\views\field\FieldPluginBase->theme(Object) (Line: 771)
Drupal\views\Plugin\views\style\StylePluginBase->elementPreRenderRow(Array)
call_user_func_array(Array, Array) (Line: 100)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. Support for this callback implementation is deprecated in 8.8.0 and will be removed in Drupal 9.0.0. See https://www.drupal.org/node/2966725', 'silenced_deprecation', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 781)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 372)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array) (Line: 710)
Drupal\views\Plugin\views\style\StylePluginBase->renderFields(Array) (Line: 577)
Drupal\views\Plugin\views\style\StylePluginBase->renderGrouping(Array, Array, 1) (Line: 468)
Drupal\views\Plugin\views\style\StylePluginBase->render(Array) (Line: 2170)
Drupal\views\Plugin\views\display\DisplayPluginBase->render() (Line: 1533)
Drupal\views\ViewExecutable->render() (Line: 183)
Drupal\views\Plugin\views\display\Page->execute() (Line: 1630)
Drupal\views\ViewExecutable->executeDisplay('page', Array) (Line: 77)
Drupal\views\Element\View::preRenderViewElement(Array)
call_user_func_array(Array, Array) (Line: 100)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. Support for this callback implementation is deprecated in 8.8.0 and will be removed in Drupal 9.0.0. See https://www.drupal.org/node/2966725', 'silenced_deprecation', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 781)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 372)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comment #5
eugeneak commented1.I mentioned Layout Builder because Domain module first gave me an error when no domain records were configured. Disabling Layout
builder let me go back to the site and configure Domain records. After that, Layout builder was re-enabled successfully.
2.I am using Acquia for my local project, because it is the easiest way to experiment with a virtual host pointing to the same site. I need it to create a mobile friendly block layout.
Comment #6
tr commentedThat means you DO have to remove the lines from
rules.services.ymlat the same time as you remove the files - I said I thought you might have to do that. To be clear, editrules.services.ymland make these changes:Remove the lines:
then remove the lines:
Save the modified
rules.services.ymlwithout moving it. Then clear your caches.Comment #7
eugeneak commentedSorry for being slow. I did what you instructed me to do and the error does not manifest itself anymore. I am very grateful to for such quick and efficient help. I don't think I will need any rules plugins in the future. However, does this finding indicate a fault in either of the two modules? Should it be addressed?
Again, I don't know how to thank you enough.
Comment #8
eugeneak commentedThe reaon for Rules to be installed in my project is a requirement in Simple FB connect module. Do the plugins I removed will have anything to do with that when I configure Simple FB Connect?
Comment #9
tr commentedObviously I was suspicious of the global context plugins for a reason ;-) Yes, these are probably the cause of the problem but it's not clear exactly why they are causing a problem. Global context plugins aren't a widely used feature of Drupal - core defines a few, Rules defines a few, Webform defines a few, but other than that they aren't really used. I don't see anything wrong with the code, but evidently something causes a problem.
Can you try one more thing? Try to see if the problem is with CurrentPathContext or with SiteContext, by removing just one of them at a time (including the change to rules.services.yml). That would help narrow down the problem and help lead to a long-term solution.
It looks like Simple FB Connect has a submodule simple_fb_connect_rules which is optional. You can uninstall that submodule if you don't need the Rules integration and if no other module requires it. However, the plugins you removed should have no effect on the operation of Simple FB Connect. The plugins just provide some global tokens that are useful in Rules, but they aren't necessary.
Comment #10
eugeneak commentedAfter restoring sitecontext.php and the corresponding section of rules.services.yml and clearing the caches, the site is in error (attached). And this error is logged in dblog:
Drupal\Component\Serialization\Exception\InvalidDataTypeException: Unexpected characters near " rules.site_context:" at line 76 (near " rules.site_context:"). in Drupal\Component\Serialization\YamlSymfony::decode() (line 40 of C:\Users\eugene\Sites\acquia\newfaces\web\core\lib\Drupal\Component\Serialization\YamlSymfony.php).
Comment #11
eugeneak commentedSecond test. After restoring currentpathcontext.php and the corresponding lines and clearing the caches, the site generated an error on profile view page:
Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in C:\Users\eugene\Sites\acquia\newfaces\web\core\lib\Drupal\Core\Cache\DatabaseBackend.php on line 167
No additional entries in dblog.
After the second test, I was not able to clear caches or to browse to any admin pages (same long error). I had to use the composer to remove rules, clear caches, install it back, then manipulate the files again as per your instructions.
Hope this helps!
Comment #12
tr commentedYour error in #10 is because you made a mistake when editing rules.services.yml - probably extra spaces or wrong indent or something like that. The yml format is sensitive sometimes.
The error in #11 indicates it's probably the CurrentPathContext that is causing the problem. That should help. Thanks.
Comment #13
eugeneak commentedI am happy to help :)
Comment #14
super_romeo commentedComment #15
umac_de commentedThe patch from #14 worked for me.
Comment #16
brianbrarian commentedI confirm that the patch for the related issue #14 (currently #37 on that issue) resolves the conflict that Rules has with Domain.
Comment #17
tr commentedClosing this as a duplicate of the two linked "related issues"