Problem/Motivation

Once you try to install the module you will see this message:

 [error]  RuntimeException: Recursive router rebuild detected. in /Users/adriancid/Sites/drupal83-test/core/lib/Drupal/Core/Routing/RouteBuilder.php:121
.....
#17 /Users/adriancid/Sites/drupal83-test/modules/contrib/xmlsitemap/xmlsitemap.install(307): Drupal\Core\Url->toString()
.....

The problem comes from this line:
\Drupal::state()->set('xmlsitemap_base_url', Url::fromRoute('<front>', [], ['absolute' => TRUE])->toString());

Proposed resolution

Not sure about why we get the error, but putting the code in a hook_update() solve the problem.

Remaining tasks

Test the patch

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

adriancid created an issue. See original summary.

adriancid’s picture

Issue summary: View changes
adriancid’s picture

I'm not sure why this problem is present but putting the code in a hook update solve the issue and the module seems to works.

remyyyyy’s picture

module xmlsitemap
Mise à jour #8003
Échec : Drupal\Core\Entity\EntityStorageException : 'xmlsitemap' entity with ID '2e9ZfIfLFCC0V-PbcDKUTb1Wk22XgjzJ6f-b16CFlPE' already exists. dans Drupal\Core\Entity\EntityStorageBase->doPreSave() (ligne 425 de core/lib/Drupal/Core/Entity/EntityStorageBase.php)

GeduR’s picture

Status: Needs review » Needs work

If the code is moved to the hook_update it will not be executed for new installations (Drupal gets the hight hook update number, stores it and only execute next updates). As the code resides in the hook_install it seems that the initial idea was to be executed on the first installation so moving to hook update could work but doesn't make sense as it is the same as removing the code.

Dave Reid’s picture

Could we just wrap this in a try/catch statement and if it fails, log an error and continue on?

Dave Reid’s picture