- Issue created by @robwj
On the 11.x branch, currently at 93ec7a93b738f0fd, I followed the steps to reproduce. I got the following user warning, which, if it's new information, also needs looking into, but no exception. Is there an additional action or step to be taken to get the LogicException?
User warning: Trying to overwrite a cache redirect for "response:[cookies:big_pipe_nojs]=:[languages:language_interface]=en:[request_format]=html:[route]=view.frontpage.page_19c08cb355eb3b07aca692af8c68cc11a934f5e596bf92a0449a69ff3afcd6d3f:[session.exists]=1:[theme]=olivero:[url.path.is_front]=is_front.1:[url.path.parent]=:[url.query_args]=:[url.site]=https://drupal.ddev.site:[user.node_grants:view]=all:[user.permissions]=is-admin:[user.roles:authenticated]=true" with one that has nothing in common, old one at address "user.permissions, session.exists, cookies:big_pipe_nojs, user.roles:authenticated, languages:language_interface, theme, url.query_args, user.node_grants:view, url.site, route, url.path.parent, url.path.is_front, route.menu_active_trails:account, route.menu_active_trails:main, url.query_args:_wrapper_format, request_format" was pointing to "user.roles:anonymous", new one points to "workspace". in Drupal\Core\Cache\VariationCache->set() (line 185 of core/lib/Drupal/Core/Cache/VariationCache.php). Drupal\Core\Cache\VariationCache->set() (Line: 215) Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber->onResponse() (Line: 246) Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() (Line: 206) Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56) Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 216) Symfony\Component\HttpKernel\HttpKernel->filterResponse() (Line: 204) Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53) Drupal\Core\StackMiddleware\Session->handle() (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28) Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32) Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116) Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90) Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53) Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 715) Drupal\Core\DrupalKernel->handle() (Line: 19)
- 🇦🇹Austria robwj
the problem is in the stable versions of core since 11.1.2
i could not tag this issue to a stable version, only to 11.1.x-dev
or is there another issue site where i report issues for the stable drupal core version?
i installed a drupal 11.2-dev version from git and the error are not present, so looks like its already fixed but not in stable?
and the error comes up since 11.1.2, before i had no problemsi get the LogicException as soon as i activate the Workspaces Module after the Navigation Module
this is my workflow with ddev version v1.24.3 on windows 10 wsl2
WSL-Version: 2.4.11.0 - Kernelversion: 5.15.167.4-1 - Ubuntu 24.04.2 LTScomposer create-project drupal/recommended-project d11.1.4.test cd d11.1.4.test ddev config --project-type drupal ddev start ddev composer install ddev composer require drush/drush ddev drush site:install -y ddev launch ddev drush in navigation ddev drush in workspaces
and than it crashes
when i deactivate the navigation module, the error is gone and i can use workspaces as expected
Unfortunately, my knowledge is currently not sufficient enough to debug the error myself
any easy tutorials to learn to debug this stuff? git log origin/11.1.x..origin/11.x --oneline
will show the unique commits in 11.x. Agit bisect
operation will determine the commit that changed a behavior.- 🇦🇹Austria robwj
i think the problem is in this file
https://git.drupalcode.org/project/drupal/-/blob/11.1.2/core/modules/nav...
line 106
public function buildNavigation(array &$page_top): void { $page_top['navigation'] = [ '#cache' => [ 'keys' => ['navigation', 'navigation'], 'max-age' => CacheBackendInterface::CACHE_PERMANENT, ], '#pre_render' => ['navigation.renderer:doBuildNavigation'], ]; }
when i commend out the cache part, the site loads again
public function buildNavigation(array &$page_top): void { $page_top['navigation'] = [ // '#cache' => [ // 'keys' => ['navigation', 'navigation'], // 'max-age' => CacheBackendInterface::CACHE_PERMANENT, // ], '#pre_render' => ['navigation.renderer:doBuildNavigation'], ]; }
when i copy the navigation module from the drupal git dev version it works
but they changed a ton of other code in the modulewhat version gets installed when i do a git clone https://git.drupalcode.org/project/drupal.git ?
the 11.x branch?
drupal status report says 11.2-dev but i can't find this branch on git.drupalcode.orgthan this version works
https://git.drupalcode.org/project/drupal/-/tree/11.x/core/modules/navig... - 🇨🇦Canada m4olivei Grimsby, ON
@robwj you're close to the relevant code by not quite. It looks like there are issue with the cacheability metadata added in
\Drupal\navigation\NavigationRenderer::doBuildNavigation
.Relevant issues that have collectively addressed this in 11.x are:
Apparently those were not backported to 11.1.x. I'll need to check in with some folks if we want to do that. In the meantime, I'll try and put together an MR to fix this.
- Merge request !11404Issue #3511374: Fix render array cacheability for navigation → (Open) created by m4olivei
- 🇨🇦Canada m4olivei Grimsby, ON
I added a MR to address the cacheability issues. The problem is that the cacheability metadata collected by from API before it calls the
#pre_render
is being thrown away and overwritten. When workspaces module is enabled, this blows up due to a mismatch with expected cache contexts.As I alluded to in #8 we could alternatively address this by backporting some issues that were committed to 11.x to 11.1.x. I'm not sure what the feasibility is there. Two of the three issues were bugs. We could probably backport the two bugs without the Integrate Workspaces feature:
- 🐛 NavigationRenderer manually adds required cache tags Active
- 📌 Use a placeholder for the navigation toolbar Active
On 11.x this isn't an issue b/c it's not a
#pre_render
anymore, it's a#lazy_builder
callback. - Merge request !11405Issue #3511374 Cherry pick commits from 11.x #3505154 and #3504386 → (Open) created by m4olivei
- 🇨🇦Canada m4olivei Grimsby, ON
I also prepped an alternative MR to see how cherry-picking commits from the bug fixes would help. It does, although 🐛 NavigationRenderer manually adds required cache tags Active required fixing a conflict.
I think I prefer back-porting these. In which case, those relevant issues should probably be re-opened to backport. Interested in what others think.
The Needs Review Queue Bot → tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.