8000 [DependencyInjection] Container recompile in Symfony 4 is faulty · Issue #25177 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DependencyInjection] Container recompile in Symfony 4 is faulty #25177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ostrolucky opened this issue Nov 27, 2017 · 8 comments
Closed

[DependencyInjection] Container recompile in Symfony 4 is faulty #25177

ostrolucky opened this issue Nov 27, 2017 · 8 comments

Comments

@ostrolucky
Copy link
Contributor
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 4.0

We are experiencing regularly this kind of error. It errors out at first load/console run, but on second run everything works ok

Warning: Uncaught ErrorException: Warning: require(/var/www/var/cache/dev/ContainerTHEJxrC/getCreate2Service.php): failed to open stream: No such file or directory in /var/www/var/cache/dev/ContainerTHEJxrC/srcDevDebugProjectContainer.php:161
Stack trace:
#0 /var/www/var/cache/dev/ContainerTHEJxrC/srcDevDebugProjectContainer.php(161): require()
#1 /var/www/vendor/symfony/dependency-injection/Container.php(232): ContainerTHEJxrC\srcDevDebugProjectContainer->load('/var/www/var/ca...')
#2 /var/www/src/DataFixtures/FixtureLoader.php(131): Symfony\Component\DependencyInjection\Container->get('App\\UseCase\\Use...')
#3 /var/www/src/DataFixtures/FixtureLoader.php(116): App\DataFixtures\FixtureLoader->loadAdminUser(Object(App\DataObject\UserAdmin\UserAdminCreateDTO))
#4 /var/www/src/DataFixtures/FixtureLoader.php(53): App\DataFixtures\FixtureLoader->persistFixtures(Object(Nelmio\Alice\ObjectSet))
#5 /var/www/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/AbstractExecutor.php(121): App\DataFixtures\Fix in /var/www/var/cache/dev/ContainerTHEJxrC/srcDevDebugProjectContainer.php on line 161

Call Stack:
    0.0005     358168   1. {main}() /var/www/bin/console:0
    0.0152    1919888   2. Symfony\Bundle\FrameworkBundle\Console\Application->run(???, ???) /var/www/bin/console:36
    0.0220    2076032   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun(???, ???) /var/www/vendor/symfony/console/Application.php:122
    0.0595    3900400   4. Symfony\Bundle\FrameworkBundle\Console\Application->doRun(???, ???) /var/www/vendor/symfony/framework-bundle/Console/Application.php:71
    0.0717    4705216   5. Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(???, ???, ???) /var/www/vendor/symfony/console/Application.php:210
    0.0717    4705216   6. Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(???, ???, ???) /var/www/vendor/symfony/framework-bundle/Console/Application.php:83
    0.0785    5317056   7. Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand->run(???, ???) /var/www/vendor/symfony/console/Application.php:849
    0.0787    5318264   8. Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand->execute(???, ???) /var/www/vendor/symfony/console/Command/Command.php:252
    0.1829   11896256   9. Doctrine\Common\DataFixtures\Executor\ORMExecutor->execute(???, ???) /var/www/vendor/doctrine/doctrine-fixtures-bundle/Command/LoadDataFixturesDoctrineCommand.php:119
    0.1829   11896952  10. Doctrine\ORM\EntityManager->transactional(???) /var/www/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/ORMExecutor.php:90
    0.1863   11955336  11. call_user_func:{/var/www/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:234}(???, ???) /var/www/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:234
    0.1863   11955336  12. Doctrine\Common\DataFixtures\Executor\ORMExecutor->Doctrine\Common\DataFixtures\Executor\{closure}(???) /var/www/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:234
    0.1863   11955336  13. Doctrine\Common\DataFixtures\Executor\ORMExecutor->load(???, ???) /var/www/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/ORMExecutor.php:88
    0.1866   11955392  14. App\DataFixtures\Development\LoadFixtures->load(???) /var/www/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/AbstractExecutor.php:121
    4.5582   15195096  15. App\DataFixtures\Development\LoadFixtures->persistFixtures(???) /var/www/src/DataFixtures/FixtureLoader.php:53
    5.6903   19071416  16. App\DataFixtures\Development\LoadFixtures->loadAdminUser(???) /var/www/src/DataFixtures/FixtureLoader.php:116
    5.6903   19071416  17. ContainerTHEJxrC\srcDevDebugProjectContainer->get(???, ???) /var/www/src/DataFixtures/FixtureLoader.php:131
    5.6903   19071416  18. ContainerTHEJxrC\srcDevDebugProjectContainer->load(???, ???) /var/www/vendor/symfony/dependency-injection/Container.php:232


Fatal error: ContainerTHEJxrC\srcDevDebugProjectContainer::load(): Failed opening required '/var/www/var/cache/dev/ContainerTHEJxrC/getCreate2Service.php' (include_path='.:/usr/local/lib/php') in /var/www/var/cache/dev/ContainerTHEJxrC/srcDevDebugProjectContainer.php on line 161

Call Stack:
    0.0005     358168   1. {main}() /var/www/bin/console:0
    0.0152    1919888   2. Symfony\Bundle\FrameworkBundle\Console\Application->run(???, ???) /var/www/bin/console:36
    0.0220    2076032   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun(???, ???) /var/www/vendor/symfony/console/Application.php:122
    0.0595    3900400   4. Symfony\Bundle\FrameworkBundle\Console\Application->doRun(???, ???) /var/www/vendor/symfony/framework-bundle/Console/Application.php:71
    0.0717    4705216   5. Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(???, ???, ???) /var/www/vendor/symfony/console/Application.php:210
    0.0717    4705216   6. Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(???, ???, ???) /var/www/vendor/symfony/framework-bundle/Console/Application.php:83
    0.0785    5317056   7. Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand->run(???, ???) /var/www/vendor/symfony/console/Application.php:849
    0.0787    5318264   8. Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand->execute(???, ???) /var/www/vendor/symfony/console/Command/Command.php:252
    0.1829   11896256   9. Doctrine\Common\DataFixtures\Executor\ORMExecutor->execute(???, ???) /var/www/vendor/doctrine/doctrine-fixtures-bundle/Command/LoadDataFixturesDoctrineCommand.php:119
    0.1829   11896952  10. Doctrine\ORM\EntityManager->transactional(???) /var/www/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/ORMExecutor.php:90
    0.1863   11955336  11. call_user_func:{/var/www/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:234}(???, ???) /var/www/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:234
    0.1863   11955336  12. Doctrine\Common\DataFixtures\Executor\ORMExecutor->Doctrine\Common\DataFixtures\Executor\{closure}(???) /var/www/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:234
    0.1863   11955336  13. Doctrine\Common\DataFixtures\Executor\ORMExecutor->load(???, ???) /var/www/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/ORMExecutor.php:88
    0.1866   11955392  14. App\DataFixtures\Development\LoadFixtures->load(???) /var/www/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/AbstractExecutor.php:121
    4.5582   15195096  15. App\DataFixtures\Development\LoadFixtures->persistFixtures(???) /var/www/src/DataFixtures/FixtureLoader.php:53
    5.6903   19071416  16. App\DataFixtures\Development\LoadFixtures->loadAdminUser(???) /var/www/src/DataFixtures/FixtureLoader.php:116
    5.6903   19071416  17. ContainerTHEJxrC\srcDevDebugProjectContainer->get(???, ???) /var/www/src/DataFixtures/FixtureLoader.php:131
    5.6903   19071416  18. ContainerTHEJxrC\srcDevDebugProjectContainer->load(???, ???) /var/www/vendor/symfony/dependency-injection/Container.php:232

@nicolas-grekas
Copy link
Member
nicolas-grekas commented Nov 27, 2017

Does this happen on every command? Only on a specific one?
Would you be able to provide a reproducer? Which Symfony version are you running?

@ostrolucky
Copy link
Contributor Author

It's not specific to commands, same errors are on web too. Reproducer is not easy, I would already provide you one if I could. For now I am just giving out warning that there might be issue with this before full release of sf 4.

symfony/asset                       4.0.x-dev 3f5117a
symfony/cache                       4.0.x-dev 3691cb2
symfony/config                      4.0.x-dev 6e6dbc6
symfony/console                     4.0.x-dev 08ab315
symfony/debug                       4.0.x-dev 26a15da
symfony/debug-bundle                4.0.x-dev ed94077
symfony/dependency-injection        4.0.x-dev 3c2a746
symfony/doctrine-bridge             4.0.x-dev 496f1ec
symfony/dotenv                      4.0.x-dev a8b75ab
symfony/event-dispatcher            4.0.x-dev 6223fb2
symfony/filesystem                  4.0.x-dev c9d4a26
symfony/finder                      4.0.x-dev c9cdda4
symfony/flex                        dev-master b83419f
symfony/form                        4.0.x-dev 4427e7f
symfony/framework-bundle            4.0.x-dev 12721e7
symfony/http-foundation             4.0.x-dev c5ba3c9
symfony/http-kernel                 4.0.x-dev 186d2ea
symfony/inflector                   4.0.x-dev 8740990
symfony/intl                        4.0.x-dev 2d6908f
symfony/lts                         dev-master 396c5fc
symfony/maker-bundle                dev-master 02aeae2
symfony/monolog-bridge              4.0.x-dev 55fead8
symfony/monolog-bundle              dev-master 2b41b8b
symfony/options-resolver            4.0.x-dev ef617a2
symfony/orm-pack                    v1.0.4
symfony/polyfill-intl-icu           dev-master d2bb2ef
symfony/polyfill-mbstring           dev-master 2ec8b39
symfony/polyfill-php72              dev-master 6de4f48
symfony/process                     4.0.x-dev 685dc11
symfony/profiler-pack               v1.0.2
symfony/property-access             4.0.x-dev 220f386
symfony/routing                     4.0.x-dev 337a9ea
symfony/security                    4.0.x-dev 92d0f2e
symfony/security-bundle             4.0.x-dev 77ba776
symfony/stopwatch                   4.0.x-dev ac0e491
symfony/templating                  4.0.x-dev 6b639f3
symfony/translation                 4.0.x-dev 6826748
symfony/twig-bridge                 4.0.x-dev 3513e77
symfony/twig-bundle                 4.0.x-dev 994fbf6
symfony/validator                   4.0.x-dev ea6c4e8
symfony/var-dumper                  4.0.x-dev bbe2c65
symfony/web-profiler-bundle         4.0.x-dev f624f9b
symfony/webpack-encore-pack         v1.0.0
symfony/yaml                        4.0.x-dev 686c7fc

@nicolas-grekas
Copy link
Member

Would you be able to know if the file is not generated, or if it has been removed? When you don't have the error, does the file exist? If yes, I've no idea what could possibly remove it.

@ostrolucky
Copy link
Contributor Author

I will take a snapshot of files in cache folder next time before doing risky activity which usually triggers this (mainly git pull + refresh) and will let you know.

@ostrolucky
Copy link
Contributor Author

We are starting to have this problem a lot. Randomly on production, during deployment and plenty in dev environment. Today, I had this issue happen to me five times in sequence. So what I said before that this is always only on first load is no longer true. Error popped up, I did refresh, another error popped up which said different file could not be opened and so on.

Would you be able to know if the file is not generated, or if it has been removed? When you don't have the error, does the file exist? If yes, I've no idea what could possibly remove it.

Requested file doesn't exist before the error, nor during

@nicolas-grekas
Copy link
Member

That could mean that when the container is just created, the file is referenced, but never created?
If confirmed, that's a bug in PhpDumper which should be inspected.

@ostrolucky
Copy link
Contributor Author

After recent findings, this is most likely concurrency issue. We found we were running multiple php processes. We killed all of them and run only one. Now it works fine.

@nicolas-grekas
Copy link
Member
nicolas-grekas commented Nov 28, 2017

See #25190 and #25117 for "poor man" fixes.
The "rich man" fix is to build your container+cache offline.

fabpot added a commit that referenced this issue Nov 29, 2017
…quests (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] Keep legacy container files for concurrent requests

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #25177
| License       | MIT
| Doc PR        | -

Because concurrent requests might still be using them,
old container files should not be removed immediately,
but on a next dump of the container.

Commits
-------

ee3b6fe [HttpKernel] Keep legacy container files for concurrent requests
@fabpot fabpot closed this as completed Nov 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
2A51
0