Infinite loop on drupal menu

Created on 16 December 2024, 5 days ago

Problem/Motivation

We updated our drupal core to 10.2.8, then on release it to our customer we noticed that in some roles if user had only that role system returns 503 of every request. The only 3 possibles cenários that were able to login and use system was:
just logged user (with no special role)
just admin
just content editor (viewer)

users with any other roles where receiving this error.

This error occurs on version 10.3.x too of drupal core for me.

Steps to reproduce

Actually I don't know how to reproduce it exactly, but I was using php 8.2 and was receiving no error, when updating to 8.3 I could verify the error message:

 "%type" => "Error"
  "@message" => "Maximum call stack size of 8339456 bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?"
  "%function" => "Drupal\Core\Menu\MenuTreeParameters->__serialize()"
  "%file" => "/var/www/html/docroot/core/lib/Drupal/Core/Menu/MenuTreeParameters.php"
  "%line" => 231
  "severity_level" => 3
  "backtrace" => array:82121 []
  "@backtrace_string" => """
    #0 [internal function]: Drupal\Core\Menu\MenuTreeParameters->__serialize()

    #1 /var/www/html/docroot/core/lib/Drupal/Core/Menu/MenuTreeStorage.php(827): serialize()

    #2 /var/www/html/docroot/core/lib/Drupal/Core/Menu/MenuLinkTree.php(102): Drupal\Core\Menu\MenuTreeStorage->loadTreeData()

    #3 /var/www/html/docroot/core/modules/system/src/Access/SystemAdminMenuBlockAccessCheck.php(105): Drupal\Core\Menu\MenuLinkTree->load()

    #4 /var/www/html/docroot/core/modules/system/src/Access/SystemAdminMenuBlockAccessCheck.php(79): Drupal\system\Access\SystemAdminMenuBlockAccessCheck->hasAccessToChildMenuItems()

    #5 [internal function]: Drupal\system\Access\SystemAdminMenuBlockAccessCheck->access()

    #6 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(160): call_user_func_array()

    #7 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(136): Drupal\Core\Access\AccessManager->performCheck()

    #8 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(93): Drupal\Core\Access\AccessManager->check()

    #9 /var/www/html/docroot/core/modules/system/src/Access/SystemAdminMenuBlockAccessCheck.php(106): Drupal\Core\Access\AccessManager->checkNamedRoute()

    #10 /var/www/html/docroot/core/modules/system/src/Access/SystemAdminMenuBlockAccessCheck.php(79): Drupal\system\Access\SystemAdminMenuBlockAccessCheck->hasAccessToChildMenuItems()

    #11 [internal function]: Drupal\system\Access\SystemAdminMenuBlockAccessCheck->access()

    #12 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(160): call_user_func_array()

    #13 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(136): Drupal\Core\Access\AccessManager->performCheck()

    #14 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(93): Drupal\Core\Access\AccessManager->check()

    #15 /var/www/html/docroot/core/modules/system/src/Access/SystemAdminMenuBlockAccessCheck.php(106): Drupal\Core\Access\AccessManager->checkNamedRoute()

    #16 /var/www/html/docroot/core/modules/system/src/Access/SystemAdminMenuBlockAccessCheck.php(79): Drupal\system\Access\SystemAdminMenuBlockAccessCheck->hasAccessToChildMenuItems()

    #17 [internal function]: Drupal\system\Access\SystemAdminMenuBlockAccessCheck->access()

    #18 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(160): call_user_func_array()

    #19 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(136): Drupal\Core\Access\AccessManager->performCheck()

    #20 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(93): Drupal\Core\Access\AccessManager->check()

    #21 /var/www/html/docroot/core/modules/system/src/Access/SystemAdminMenuBlockAccessCheck.php(106): Drupal\Core\Access\AccessManager->checkNamedRoute()

    #22 /var/www/html/docroot/core/modules/system/src/Access/SystemAdminMenuBlockAccessCheck.php(79): Drupal\system\Access\SystemAdminMenuBlockAccessCheck->hasAccessToChildMenuItems()

    #23 [internal function]: Drupal\system\Access\SystemAdminMenuBlockAccessCheck->access()

    #24 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(160): call_user_func_array()

    #25 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(136): Drupal\Core\Access\AccessManager->performCheck()

    #26 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(93): Drupal\Core\Access\AccessManager->check()

    #27 /var/www/html/docroot/core/modules/system/src/Access/SystemAdminMenuBlockAccessCheck.php(106): Drupal\Core\Access\AccessManager->checkNamedRoute()

    #28 /var/www/html/docroot/core/modules/system/src/Access/SystemAdminMenuBlockAccessCheck.php(79): Drupal\system\Access\SystemAdminMenuBlockAccessCheck->hasAccessToChildMenuItems()

    #29 [internal function]: Drupal\system\Access\SystemAdminMenuBlockAccessCheck->access()

    #30 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(160): call_user_func_array()

    #31 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(136): Drupal\Core\Access\AccessManager->performCheck()

    #32 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(93): Drupal\Core\Access\AccessManager->check()

    #33 /var/www/html/docroot/core/modules/system/src/Access/SystemAdminMenuBlockAccessCheck.php(106): Drupal\Core\Access\AccessManager->checkNamedRoute()

    #34 /var/www/html/docroot/core/modules/system/src/Access/SystemAdminMenuBlockAccessCheck.php(79): Drupal\system\Access\SystemAdminMenuBlockAccessCheck->hasAccessToChildMenuItems()

    #35 [internal function]: Drupal\system\Access\SystemAdminMenuBlockAccessCheck->access()

There was a loop in the menu module, since I was updating to drupal core 10.3.0, 10.3.1 untill 10.3.8 I could verify that all this versions has the same issue, in some cases the start of stack trace could start at diferent points but there is a loop in this files/funcitons:

 #11 [internal function]: Drupal\system\Access\SystemAdminMenuBlockAccessCheck->access()

    #12 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(160): call_user_func_array()

    #13 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(136): Drupal\Core\Access\AccessManager->performCheck()

    #14 /var/www/html/docroot/core/lib/Drupal/Core/Access/AccessManager.php(93): Drupal\Core\Access\AccessManager->check()

    #15 /var/www/html/docroot/core/modules/system/src/Access/SystemAdminMenuBlockAccessCheck.php(106): Drupal\Core\Access\AccessManager->checkNamedRoute()

    #16 /var/www/html/docroot/core/modules/system/src/Access/SystemAdminMenuBlockAccessCheck.php(79): Drupal\system\Access\SystemAdminMenuBlockAccessCheck->hasAccessToChildMenuItems()

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

10.2

Component

menu.module

Created by

🇧🇷Brazil andrelzgava

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024