pimcore / pimcore

Core Framework for the Open Source Data & Experience Management Platform (PIM, MDM, CDP, DAM, DXP/CMS & Digital Commerce)
http://www.pimcore.com
Other
3.41k stars 1.44k forks source link

Fatal Compile Error: Failed opening required getSwiftmailer_EmailSender_ListenerService.php #2434

Closed IgorBenko closed 6 years ago

IgorBenko commented 6 years ago

While trying to update to build 174, I keep getting this error:

In appDevDebugProjectContainer.php line 1724:

  Compile Error: ContainerXecnmwh\appDevDebugProjectContainer::load(): Failed opening required '/var/www/var/cache/dev/Cont  
  ainerXecnmwh/getSwiftmailer_EmailSender_ListenerService.php' (include_path='/var/www/vendor/pear/net_url2:.:/usr/share/ph  
  p')                                                                                                                        

I am updating from build 158 by issuing this command: bin/console update -u 174

The issue is described here: https://github.com/symfony/symfony/issues/25654

Changing the symfony/symfony dependency to 3.4.*@dev unfortunately didn't solve this problem for me.

Did you encounter this issue in your environments?

IgorBenko commented 6 years ago

Whole error message:

Warning: Uncaught Symfony\Component\Debug\Exception\ContextErrorException: Warning: require(/var/www/var/cache/dev/ContainerXecnmwh/getSwiftmailer_EmailSender_ListenerService.php): failed to open stream: No such file or directory in /var/www/var/cache/dev/ContainerXecnmwh/appDevDebugProjectContainer.php:1724
Stack trace:
#0 /var/www/var/cache/dev/ContainerXecnmwh/appDevDebugProjectContainer.php(1724): require()
#1 /var/www/var/cache/dev/ContainerXecnmwh/appDevDebugProjectContainer.php(3643): ContainerXecnmwh\appDevDebugProjectContainer->load('/var/www/var/ca...')
#2 /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(229): ContainerXecnmwh\appDevDebugProjectContainer->ContainerXecnmwh\{closure}()
#3 /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(61): Symfony\Component\EventDispatcher\EventDispatcher->sortListeners('console.termina...')
#4 /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.p in /var/www/var/cache/dev/ContainerXecnmwh/appDevDebugProjectContainer.php on line 1724

Call Stack:
    0.0001     351104   1. {main}() /var/www/bin/console:0
    0.1104    9958824   2. Pimcore\Console\Application->run() /var/www/bin/console:36
    0.1156   10290472   3. Pimcore\Console\Application->doRun() /var/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:148
    0.1156   10290472   4. Pimcore\Console\Application->doRun() /var/www/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:71
    0.1805   14268040   5. Pimcore\Console\Application->doRunCommand() /var/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:240
    0.1805   14268040   6. Pimcore\Console\Application->doRunCommand() /var/www/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:83
   47.6676   15502168   7. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->dispatch() /var/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:983
   47.6676   15502168   8. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->preProcess() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:134
   47.6676   15502168   9. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->getListeners() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:250
   47.6676   15502168  10. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->getListeners() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php:128
   47.6676   15502168  11. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->sortListeners() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:61
   47.6676   15502248  12. ContainerXecnmwh\appDevDebugProjectContainer->ContainerXecnmwh\{closure}() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:229
   47.6676   15502248  13. ContainerXecnmwh\appDevDebugProjectContainer->load() /var/www/var/cache/dev/ContainerXecnmwh/appDevDebugProjectContainer.php:3643

Variables in local scope (#13):
  $file = '/var/www/var/cache/dev/ContainerXecnmwh/getSwiftmailer_EmailSender_ListenerService.php'
  $lazyLoad = TRUE

Fatal error: ContainerXecnmwh\appDevDebugProjectContainer::load(): Failed opening required '/var/www/var/cache/dev/ContainerXecnmwh/getSwiftmailer_EmailSender_ListenerService.php' (include_path='/var/www/vendor/pear/net_url2:.:/usr/share/php') in /var/www/var/cache/dev/ContainerXecnmwh/appDevDebugProjectContainer.php on line 1724

Call Stack:
    0.0001     351104   1. {main}() /var/www/bin/console:0
    0.1104    9958824   2. Pimcore\Console\Application->run() /var/www/bin/console:36
    0.1156   10290472   3. Pimcore\Console\Application->doRun() /var/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:148
    0.1156   10290472   4. Pimcore\Console\Application->doRun() /var/www/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:71
    0.1805   14268040   5. Pimcore\Console\Application->doRunCommand() /var/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:240
    0.1805   14268040   6. Pimcore\Console\Application->doRunCommand() /var/www/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:83
   47.6676   15502168   7. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->dispatch() /var/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:983
   47.6676   15502168   8. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->preProcess() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:134
   47.6676   15502168   9. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->getListeners() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:250
   47.6676   15502168  10. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->getListeners() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php:128
   47.6676   15502168  11. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->sortListeners() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:61
   47.6676   15502248  12. ContainerXecnmwh\appDevDebugProjectContainer->ContainerXecnmwh\{closure}() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:229
   47.6676   15502248  13. ContainerXecnmwh\appDevDebugProjectContainer->load() /var/www/var/cache/dev/ContainerXecnmwh/appDevDebugProjectContainer.php:3643

Variables in local scope (#13):
  $file = '/var/www/var/cache/dev/ContainerXecnmwh/getSwiftmailer_EmailSender_ListenerService.php'
  $lazyLoad = TRUE

Warning: Uncaught Symfony\Component\Debug\Exception\ContextErrorException: Warning: require(/var/www/var/cache/dev/ContainerXecnmwh/getSwiftmailer_EmailSender_ListenerService.php): failed to open stream: No such file or directory in /var/www/var/cache/dev/ContainerXecnmwh/appDevDebugProjectContainer.php:1724
Stack trace:
#0 /var/www/var/cache/dev/ContainerXecnmwh/appDevDebugProjectContainer.php(1724): require()
#1 /var/www/var/cache/dev/ContainerXecnmwh/appDevDebugProjectContainer.php(3643): ContainerXecnmwh\appDevDebugProjectContainer->load('/var/www/var/ca...')
#2 /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(229): ContainerXecnmwh\appDevDebugProjectContainer->ContainerXecnmwh\{closure}()
#3 /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(61): Symfony\Component\EventDispatcher\EventDispatcher->sortListeners('console.termina...')
#4 /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.p in /var/www/var/cache/dev/ContainerXecnmwh/appDevDebugProjectContainer.php on line 1724

Call Stack:
    0.0001     349088   1. {main}() /var/www/bin/console:0
    0.0992    9931680   2. Pimcore\Console\Application->run() /var/www/bin/console:36
    0.1089   10263328   3. Pimcore\Console\Application->doRun() /var/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:148
    0.1089   10263328   4. Pimcore\Console\Application->doRun() /var/www/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:71
    0.1751   14240896   5. Pimcore\Console\Application->doRunCommand() /var/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:240
    0.1751   14240896   6. Pimcore\Console\Application->doRunCommand() /var/www/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:83
  125.2454   16534960   7. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->dispatch() /var/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:983
  125.2454   16534960   8. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->preProcess() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:134
  125.2454   16534960   9. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->getListeners() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:250
  125.2455   16534960  10. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->getListeners() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php:128
  125.2455   16534960  11. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->sortListeners() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:61
  125.2455   16535040  12. ContainerXecnmwh\appDevDebugProjectContainer->ContainerXecnmwh\{closure}() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:229
  125.2455   16535040  13. ContainerXecnmwh\appDevDebugProjectContainer->load() /var/www/var/cache/dev/ContainerXecnmwh/appDevDebugProjectContainer.php:3643

Variables in local scope (#13):
  $file = '/var/www/var/cache/dev/ContainerXecnmwh/getSwiftmailer_EmailSender_ListenerService.php'
  $lazyLoad = TRUE

Fatal error: ContainerXecnmwh\appDevDebugProjectContainer::load(): Failed opening required '/var/www/var/cache/dev/ContainerXecnmwh/getSwiftmailer_EmailSender_ListenerService.php' (include_path='/var/www/vendor/pear/net_url2:.:/usr/share/php') in /var/www/var/cache/dev/ContainerXecnmwh/appDevDebugProjectContainer.php on line 1724

Call Stack:
    0.0001     349088   1. {main}() /var/www/bin/console:0
    0.0992    9931680   2. Pimcore\Console\Application->run() /var/www/bin/console:36
    0.1089   10263328   3. Pimcore\Console\Application->doRun() /var/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:148
    0.1089   10263328   4. Pimcore\Console\Application->doRun() /var/www/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:71
    0.1751   14240896   5. Pimcore\Console\Application->doRunCommand() /var/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:240
    0.1751   14240896   6. Pimcore\Console\Application->doRunCommand() /var/www/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:83
  125.2454   16534960   7. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->dispatch() /var/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:983
  125.2454   16534960   8. Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->preProcess() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:134
  125.2454   16534960   9. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->getListeners() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:250
  125.2455   16534960  10. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->getListeners() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php:128
  125.2455   16534960  11. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->sortListeners() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:61
  125.2455   16535040  12. ContainerXecnmwh\appDevDebugProjectContainer->ContainerXecnmwh\{closure}() /var/www/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:229
  125.2455   16535040  13. ContainerXecnmwh\appDevDebugProjectContainer->load() /var/www/var/cache/dev/ContainerXecnmwh/appDevDebugProjectContainer.php:3643

Variables in local scope (#13):
  $file = '/var/www/var/cache/dev/ContainerXecnmwh/getSwiftmailer_EmailSender_ListenerService.php'
  $lazyLoad = TRUE

13:24:58 CRITICAL  [php] Fatal Compile Error: ContainerXecnmwh\appDevDebugProjectContainer::load(): Failed opening required '/var/www/var/cache/dev/ContainerXecnmwh/getSwiftmailer_EmailSender_ListenerService.php' (include_path='/var/www/vendor/pear/net_url2:.:/usr/share/php') ["exception" => Symfony\Component\Debug\Exception\FatalErrorException { …}] []

In appDevDebugProjectContainer.php line 1724:

  Compile Error: ContainerXecnmwh\appDevDebugProjectContainer::load(): Failed opening required '/var/www/var/cache/dev/Cont  
  ainerXecnmwh/getSwiftmailer_EmailSender_ListenerService.php' (include_path='/var/www/vendor/pear/net_url2:.:/usr/share/ph  
  p')                                                                                                                        
jansarmir commented 6 years ago

same problem in build 166 when clearing cache in admin

maff commented 6 years ago

@IgorBenko does this only happen when you update via CLI or also via GUI?

IgorBenko commented 6 years ago

@maff I just tried updating from 174 to 175 via GUI and while it seemed to increase the build number to 175 I still got an 505 response, but couldn't find anything related in log files. Will restore my system to 158 and try updating again through GUI to 174.

IgorBenko commented 6 years ago

@maff After increasing the php-fpm timeout the GUI installation worked without problems. So it seems to be related only to the console command. Unfortunately we are quite dependant on the update console command for one particular project, so a fix for this would be greatly appreciated.

maff commented 6 years ago

@IgorBenko thanks for testing, we'll look into the issue soon @jansarmir I can confirm this also happens when clearing the cache in the admin interface, we'll look into that as well

maff commented 6 years ago

@IgorBenko there's no proper solution yet, but you could try to patch the following in the meantime:

Adding the following to the top of the execute method in UpdateCommand and InternalUpdateProcessorCommand:

// remove terminate event listeners as they break with a cleared container
$eventDispatcher = $this->getContainer()->get('event_dispatcher');
foreach ($eventDispatcher->getListeners(ConsoleEvents::TERMINATE) as $listener) {
    $eventDispatcher->removeListener(ConsoleEvents::TERMINATE, $listener);
}

and/or adding exit() calls to the end of the execute method.

Symfony 3.4 introduced a new way to write its container cache files (split up into multiple files). If something calls $container->get() on the stale container (its cache has already been removed), that container instance tries to require() files which do not exist anymore leading to the error. This is the case for the Swiftmailer listener which tries to fetch the mailer service in kernel.terminate and/or console.terminate.

IgorBenko commented 6 years ago

Thanks a lot @maff for the clarification, that makes sense, yes. Will test your suggestion and come back to you with results.

IgorBenko commented 6 years ago

@maff thanks a lot. Will test your fix as soon as the next build is out.

IgorBenko commented 6 years ago

@maff I tested it now and it unfortunately didn't solve the problem. I get the same swiftmailer error. I was updating from build 133. Was the idea that all old systems must be patched before running the update?

maff commented 6 years ago

@IgorBenko we didn't retroactively patch the updating process yet, so at the moment a manual patch is needed before updating via CLI. Could you try to update to build 160, then apply the following patch and continue the update to the latest build?

https://github.com/pimcore/pimcore/commit/a112e3be0f203c6aa6b3a7de5f22999e5e81ed58.patch

The patch can be applied as follows:

$ patch -p1 < path-to-patch-file.patch
IgorBenko commented 6 years ago

@maff Yes, patching at build 160 worked like a charm. So the workflow would be?

Is there a plan to retroactively patch the updating process?

Thanks again for great support!

maff commented 6 years ago

@IgorBenko we now retroactively patched build 160 and tested the update from 158 to 178 - it should now work in both the CLI and the Web-Updater without any manual patching. Could you try the update again on your environment?

IgorBenko commented 6 years ago

@maff Thanks for the update. I tested it and it unfortunately stopped at 160 (updating from 133). Rerunning the setup afterwards then successfully completed at 178.

After it stopped at 160, I checked the files and the patch has already been applied. Could this be a problem with the unpatched files being loaded at runtime? Or maybe an OpCache problem?

maff commented 6 years ago

@IgorBenko I just tested to update from a fresh 133 install to 178 on both CLI and web and it seems to work in general. I ran into #2454 once, but that update had errors due to file permission errors during the composer update.

In doubt, an update to 160 and then subsequent updates should work fine.

IgorBenko commented 6 years ago

@maff Thanks. I did it twice and it both times broke at 160 with the swiftMailer error. Subsequent runs were in both cases then successful. Will try to talk to customer if that's a dealbreaker, hopefully not. Thanks again for the support!