Skip to content

Dependency Injection inifinite loop handling circular references consuming memory  #39015

Closed
@soyuka

Description

@soyuka

Symfony version(s) affected: 5.2.x

Description
Clearing the cache with latest symfony breaks on api-platform/core

How to reproduce

git clone git@github.com:api-platform/core
cd core
# If you have moreutils, or just add the minimum-stability dev to the composer.json
jq '. + {"minimum-stability": "dev"}' composer.json | sponge composer.json
composer install
php tests/Fixtures/app/console cache:warmup -vv

This will lead to an out of memory error (be sure you don't use memory_limit=-1)

Possible Solution

Revert the code changed in PhpDumper (see https://github.com/symfony/symfony/pull/38980/files#diff-82d7ebdd6477cecb404b0d3f100a9026e950529edb9a665460ae0330dfad7080L454)

        foreach ($edges as $edge) {
            $node = $edge->getDestNode();
            $id = $node->getId();
+            if (!$node->getValue() instanceof Definition || $sourceId === $id || $edge->isLazy() || $edge->isWeak()) {
-            if (!$node->getValue() instanceof Definition || $sourceId === $id || $edge->isWeak()) {
                continue;
            }

If you reproduced and want to try the fix, just rm -rf tests/Fixtures/app/var/cache/ and use the command again.

ref: #38980

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy