Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[2.3][DIC] ContainerBuilder behaviour issue #7636

Closed
@ghost

Description

Since upgrading from Symfony 2.2 to 2.3, I think I might have exposed a change in behaviour that might be a bug.

Background

We made a small change to our kernel to compile the DIC with ContainerBuilder so that we can still add definitions to the DIC after compile. It simply means one cannot overwrite existing services after compile (which I consider a feature). In any case, it worked in 2.2 and there was no reason for it not to.

Since upgrading to 2.3, if I run app/console clear:cache I get a weird exception about the request service. However, if I run app/console cache:clear --no-warmup, then I get no exception. Please see my commit for details of the small change.

$ app/console -v cache:clear
Clearing the cache for the dev environment with debug true

  [Symfony\Component\DependencyInjection\Exception\InactiveScopeException]
    You cannot create a service ("request") of an inactive scope
    ("request").


Exception trace:
 () at app\cache\de_\ap_DevDebugProjectContainer.php:1427
 ap_DevDebugProjectContainer->getRequestService() at app\bootstrap.php.cache:133
 Symfony\Component\DependencyInjection\Container->get() at Symfony\Component\DependencyInjection\ContainerBuilder.php:431
 Symfony\Component\DependencyInjection\ContainerBuilder->get() at app\cache\de_\ap_DevDebugProjectContainer.php:953
 ap_DevDebugProjectContainer->getFragment_HandlerService() at app\bootstrap.php.cache:133
 Symfony\Component\DependencyInjection\Container->get() at Symfony\Component\DependencyInjection\ContainerBuilder.php:431
 Symfony\Component\DependencyInjection\ContainerBuilder->get() at app\cache\de_\ap_DevDebugProjectContainer.php:2666
 ap_DevDebugProjectContainer->getTwigService() at app\bootstrap.php.cache:133
 Symfony\Component\DependencyInjection\Container->get() at Symfony\Component\DependencyInjection\ContainerBuilder.php:431
 Symfony\Component\DependencyInjection\ContainerBuilder->get() at app\cache\de_\ap_DevDebugProjectContainer.php:65
 ap_DevDebugProjectContainer->getAssetic_AssetManagerService() at app\bootstrap.php.cache:133
 Symfony\Component\DependencyInjection\Container->get() at Symfony\Component\DependencyInjection\ContainerBuilder.php:431
 Symfony\Component\DependencyInjection\ContainerBuilder->get() at vendor\symfony\assetic-bundle\Symfony\Bundle\AsseticBundle\CacheWarmer\AssetManagerCacheWarmer.php:33
 Symfony\Bundle\AsseticBundle\CacheWarmer\AssetManagerCacheWarmer->warmUp() at Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate.php:47
 Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() at Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:117
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() at Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:83
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() at Symfony\Component\Console\Command\Command.php:240
 Symfony\Component\Console\Command\Command->run() at Symfony\Component\Console\Application.php:940
 Symfony\Component\Console\Application->doRunCommand() at Symfony\Component\Console\Application.php:204
 Symfony\Component\Console\Application->doRun() at Symfony\Bundle\FrameworkBundle\Console\Application.php:78
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at Symfony\Component\Console\Application.php:117
 Symfony\Component\Console\Application->run() at app\console:22

    cache:clear [--no-warmup] [--no-optional-warmers]

I believe the problem comes in with the new "syncronized" services code that was added.
@beberlei @fabpot

I have no idea why only the cache warmers trigger this error and my application continues to work from the browser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions