Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Regression when dumping container which affects cache:clear and others commands #49018

Copy link
Copy link
Closed
@spantaleev

Description

@spantaleev
Issue body actions

Symfony version(s) affected

6.2.3

Description

cache:clear --env=prod --no-debug -vv fails with:

In HydratorException.php line 23:
                                                                  
  [Doctrine\ODM\MongoDB\Hydrator\HydratorException]               
  You must configure a hydrator directory. See docs for details.  
                                                                  

Exception trace:
  at /code/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Hydrator/HydratorException.php:23
 Doctrine\ODM\MongoDB\Hydrator\HydratorException::hydratorDirectoryRequired() at /code/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Hydrator/HydratorFactory.php:101
 Doctrine\ODM\MongoDB\Hydrator\HydratorFactory->__construct() at /code/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php:194
 Doctrine\ODM\MongoDB\DocumentManager->__construct() at /code/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php:226
 Doctrine\ODM\MongoDB\DocumentManager::create() at /code/var/cache/symfony/prod/ContainerLf3kA8V/getDoctrineMongodb_Odm_DefaultDocumentManagerService.php:24
 ContainerLf3kA8V\getDoctrineMongodb_Odm_DefaultDocumentManagerService::do() at /code/var/cache/symfony/prod/ContainerLf3kA8V/Argonics_KernelProdContainer.php:411
 ContainerLf3kA8V\Argonics_KernelProdContainer->load() at /code/vendor/symfony/dependency-injection/Container.php:216
 Symfony\Component\DependencyInjection\Container->make() at /code/vendor/symfony/dependency-injection/Container.php:198
 Symfony\Component\DependencyInjection\Container->get() at /code/vendor/symfony/doctrine-bridge/ManagerRegistry.php:34
 Symfony\Bridge\Doctrine\ManagerRegistry->getService() at /code/vendor/doctrine/persistence/src/Persistence/AbstractManagerRegistry.php:213
 Doctrine\Persistence\AbstractManagerRegistry->getManagers() at /code/vendor/doctrine/mongodb-odm-bundle/CacheWarmer/HydratorCacheWarmer.php:75
 Doctrine\Bundle\MongoDBBundle\CacheWarmer\HydratorCacheWarmer->warmUp() at /code/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php:96
 Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() at /code/vendor/symfony/http-kernel/Kernel.php:526
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at /code/vendor/symfony/http-kernel/Kernel.php:709
 Symfony\Component\HttpKernel\Kernel->preBoot() at /code/vendor/symfony/http-kernel/Kernel.php:122
 Symfony\Component\HttpKernel\Kernel->boot() at /code/vendor/symfony/framework-bundle/Console/Application.php:148
 Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands() at /code/vendor/symfony/framework-bundle/Console/Application.php:69
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /code/vendor/symfony/console/Application.php:168
 Symfony\Component\Console\Application->run() at /code/bin/console:39

How to reproduce

  1. Completely delete the cache directory to ensure we're starting from scratch (e.g. rm -rf var/cache/symfony/prod)
  2. Run cache:clear for the prod environment (cache:clear --env=prod --no-debug -vv)
  3. It errors out with the aforementioned error

Running cache:clear for the dev environment works as expected (hydrator_dir is correctly passed to Doctrine MongoDB ODM's Hydrator), which made me suspect that this has something to do with dependency injection and dumping the container.

Other commands (like doctrine:mongodb:schema:update) also fail with the same error.

Possible Solution

It turns out that downgrading symfony/dependency-injection from 6.2.3 to 6.2.2 fixes the problem.

I've tracked this problem down to #48791, and more specifically to this change:

-if ($sourceId === $id || !$node->getValue() instanceof Definition || $edge->isLazy() || $edge->isWeak()) {
+if ($sourceId === $id || !$node->getValue() instanceof Definition || $edge->isWeak()) {

Adding back || $edge->isLazy(), deleting the cache directory seems to make cache:clear complete successfully.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.