代码之家  ›  专栏  ›  技术社区  ›  crmpicco

symfony3.4应用程序在执行cache:clear with 热身

  •  1
  • crmpicco  · 技术社区  · 7 年前

    appbundle.services.course_manager:
        class:  AppBundle\Services\CourseManager
        calls:
            - [setDoctrine, ['@doctrine']]
    

    在3.4中没有定义,只是使用 @required 注释如下:

    class CourseManager
    {
       use DoctrineTrait;
    }
    
    trait DoctrineTrait
    {  
        /**
         * @required
         * @param RegistryInterface $doctrine
         */
        public function setDoctrine(RegistryInterface $doctrine)
        {
            $this->doctrine = $doctrine;
        }
    }
    

    bin/console cache:clear --env=dev -vvv 我得到以下信息:

    // Warming up cache...                                                                                                 
    
    PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1021054976 bytes) in /private/var/www/crmpicco/symfony/vendor/symfony/symfony/src/Symfony/Component/Config/Resource/ReflectionClassResource.php on line 137
    
    Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1021054976 bytes) in /private/var/www/crmpicco/symfony/vendor/symfony/symfony/src/Symfony/Component/Config/Resource/ReflectionClassResource.php on line 137
    Fluent\Logger\FluentLogger Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1021054976 bytes) signup.php: {"message":"Fatal Error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1021054976 bytes)","context":{"exception":{}},"level":500,"level_name":"CRITICAL","channel":"php","datetime":{"date":"2018-10-17 08:18:41.313528","timezone_type":3,"timezone":"UTC"},"extra":[]}
    08:18:41 CRITICAL  [php] Fatal Error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1021054976 bytes)
    [
      "exception" => Symfony\Component\Debug\Exception\OutOfMemoryException {
        #message: "Error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1021054976 bytes)"
        #code: 0
        #file: "/private/var/www/crmpicco/symfony/vendor/symfony/symfony/src/Symfony/Component/Config/Resource/ReflectionClassResource.php"
        #line: 137
        #severity: E_ERROR
      }
    ]
    
    In ReflectionClassResource.php line 137:
    
      [Symfony\Component\Debug\Exception\OutOfMemoryException]                                       
      Error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1021054976 bytes)  
    
    Exception trace:
    
    cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>
    

    但是,当我用 --no-warmup

    输出没有指出错误的来源,所以我很难跟踪它。

    另外,我很希望保留DI的特性,因为它贯穿于我的应用程序中,并且需要大量的重构来移除它们,并用一个只用于DI的构造函数来替换它们。

    0 回复  |  直到 7 年前