Skip to content

[DI] Compile Error on cache warming since Symfony 3.4 if cache warmed on different machine already (host vs. VM) #25857

@jlekowski

Description

@jlekowski
Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Symfony version >=3.4

To reproduce you need a host machine and VM/Docker:

  1. On host run:
$ bin/console cache:clear --no-warmup -vv --env=dev && bin/console cache:warmup -vv --env=dev
  1. On VM/Docker run:
$ bin/console
  1. On host run:
$ bin/console

PHP Warning:  Uncaught ErrorException: Warning: require({removed_path}/var/cache/dev/ContainerDbj4Wfg/getCacheWarmerService.php): failed to open stream: No such file or directory in {removed_path}/var/cache/dev/ContainerDbj4Wfg/srcDevDebugProjectContainer.php:353
Stack trace:
#0 {removed_path}/var/cache/dev/ContainerDbj4Wfg/srcDevDebugProjectContainer.php(353): require()
#1 {removed_path}/vendor/symfony/dependency-injection/Container.php(232): ContainerDbj4Wfg\srcDevDebugProjectContainer->load('/home/jerzy/dev...')
#2 {removed_path}/vendor/symfony/http-kernel/Kernel.php(543): Symfony\Component\DependencyInjection\Container->get('cache_warmer')
#3 {removed_path}/vendor/symfony/http-kernel/Kernel.php(125): Symfony\Component\HttpKernel\Kernel->initializeContainer()
#4 {removed_path}/vendor/symfony/framework-bundle/Console/Application.php(63): Symfony\Component\HttpKer in {removed_path}/var/cache/dev/ContainerDbj4Wfg/srcDevDebugProjectContainer.php on line 353
PHP Fatal error:  ContainerDbj4Wfg\srcDevDebugProjectContainer::load(): Failed opening required '{removed_path}/var/cache/dev/ContainerDbj4Wfg/getCacheWarmerService.php' (include_path='.:/usr/share/php') in {removed_path}/var/cache/dev/ContainerDbj4Wfg/srcDevDebugProjectContainer.php on line 353

In srcDevDebugProjectContainer.php line 353:
                                                                                                                                                                                                                  
  Compile Error: ContainerDbj4Wfg\srcDevDebugProjectContainer::load(): Failed opening required '{removed_path}/var/cache/dev/ContainerDbj4Wfg/getCacheWarmerService.php' (include_path='.  
  :/usr/share/php')
  1. On host run again:
$ bin/console

PHP Warning:  include({removed_path}/var/cache/dev/ContainerDbj4Wfg/srcDevDebugProjectContainer.php): failed to open stream: No such file or directory in {removed_path}/var/cache/dev/srcDevDebugProjectContainer.php on line 7
PHP Warning:  include(): Failed opening '{removed_path}/var/cache/dev/ContainerDbj4Wfg/srcDevDebugProjectContainer.php' for inclusion (include_path='.:/usr/share/php') in {removed_path}/var/cache/dev/srcDevDebugProjectContainer.php on line 7
Symfony 4.0.3 (kernel: src, env: dev, debug: true)

But this time, besides the warning, I get correct list of all command.

  1. On host run again:
$ bin/console

Working as expected.

The issue is reproducible also when warming up cache on VM/Docker first, running command on host, and accessing VM/Docker through web. First web request throws an error, second is OK.

In 3.3 there were no Container{$hash} (generated here https://github.com/symfony/dependency-injection/blob/master/Dumper/PhpDumper.php#L212) folders in cache, since 3.4 there is one, and hash generated on host and VM/Docker is different. Here is a link to some debugging I did: https://gist.github.com/jlekowski/931fd71e06655bfa45a7ac0200e8051b

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