Problem/Motivation

Following the #3609101: Recreating a trashed redirect inside a workspace fails with a duplicate hash database error fix, the following exception is thrown when used on a site with domain's domain_config_ui submodule enabled:

Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "router.route_provider", path: "options_request_listener -> router.route_provider -> path_processor_manager -> path_alias.path_processor -> path_alias.manager -> path_alias.repository -> trash.manager -> Drupal\trash\Hook\TrashHandler\RedirectTrashHandler -> redirect.repository -> router -> router.no_access_checks". in Drupal\Component\DependencyInjection\Container->get() (line 148 of core/lib/Drupal/Component/DependencyInjection/Container.php). 

This happens because Trash handler services are registered even when they're not enabled.

It seems that running Drupal 11.4 avoids the circular reference crash due to #3571046: Use tagged iterators in PathProcessorManager and RouteProcessorManager since that lazy loads the services.

Steps to reproduce

1. On Drupal 11.3, have the following modules installed: Trash, Redirect and Domain Config UI.
2. Enable Trash on Path Alias and Node types.
3. Viewing certain admin page or making an AJAX request (e.g. delete) should trigger the exception.

Proposed resolution

Lazy load the redirect repository so that Trash doesn't have to wrestle with service dependency issues.

Remaining tasks

Provide MR.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Issue fork trash-3619066

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

codebymikey created an issue. See original summary.

codebymikey’s picture

Issue summary: View changes
Status: Active » Needs review
codebymikey’s picture

Priority: Normal » Critical

Raising as critical given the severity with no means of working around it except downgrading.

amateescu made their first commit to this issue’s fork.

amateescu’s picture

Status: Needs review » Fixed

Merged into 3.1.x and cherry-picked the bits that were useful to 3.x. Nice find!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.