在我正在从事的Symfony 2.7项目中,我通过Composer 1.6.5使用了很多软件包。
几天以来,我不再可以添加新软件包或重建composer.lock。它会不断耗尽内存。
当我尝试添加新软件包时,我开始注意到该问题。但是问题不在于那个包裹。因为作为测试,我现在试图通过删除该composer.lock文件并执行以下命令来重建我的composer.lock:
php -d memory_limit=-1 C:/ProgramData/ComposerSetup/bin/composer.phar install -vvv
当我在运行该命令时跟踪我的内存消耗时,它从未超过1.5G限制,而我的Windows机器仍然有大量可用的内存。
我注意到,在作曲家尝试解析一个特定的程序包并将其写入缓存时/之后,通常会引发该错误。一个特定的程序包确实会消耗大量内存(高达0.5G)。一些研究告诉我,这个程序包没有错,它已经存在于我们的项目中,并且已经存在于composer.json中已有三年多了。我还在Mac上运行了相同的composer install命令,它确实设法解决了该程序包并将其写入缓存,但是后来在尝试删除另一个不相关的程序包时失败了,因为那时Mac上的内存已被删除。完全耗尽。
这是我得到的错误:
...
Downloading http://packagist.org/p/kriswallsmith/spork%24dafe3f5808d858c7b15bd464923710bf24d5f7457b7b6c50a298ca1bea1a35a0.json
Writing C:/Users/david/AppData/Local/Composer/repo/https---packagist.org/provider-kriswallsmith$spork.json into cache
Fatal error: Out of memory (allocated 1424228352) (tried to allocate 268435456 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220
PHP Fatal error: Out of memory (allocated 1424228352) (tried to allocate 268435456 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220
/cygdrive/c/ProgramData/ComposerSetup/bin/composer: line 10: 10284 Segmentation fault php "${dir}/composer.phar" "$@"
奇怪的是,直到几天前,当一个使用过的作曲家要求我正在处理的程序包时,它还可以正常工作。
这是我的3个问题:
这是我的composer.json文件:
{
"name": "kulsol",
"license": "proprietary",
"type": "project",
"autoload": {
"psr-4": {
"": "src/",
"SymfonyStandard\\": "app/SymfonyStandard/"
},
"files": [
"src/helpers.php",
"app/AppKernel.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.7.*",
"doctrine/orm": "2.5.*",
"doctrine/dbal": "<2.6",
"doctrine/doctrine-bundle": "~1.4",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "~3.0,>=3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"jms/serializer-bundle": "~2.0.0",
"gedmo/doctrine-extensions": "2.4.3",
"symfony/stopwatch": "^2.7",
"vich/uploader-bundle": "^0.14.0",
"nesbot/carbon": "^1.21",
"swiftmailer/swiftmailer": "^5.4",
"mtdowling/cron-expression": "^1.0",
"cron/cron-bundle": "^1.0",
"mustache/mustache": "^2.9",
"leafo/lessphp": "<0.5",
"friendsofsymfony/elastica-bundle": "^3.1",
"guzzlehttp/guzzle": "^6.1",
"oro/doctrine-extensions": "^1.0",
"willdurand/geocoder-bundle": "^4.0",
"rlerdorf/opcache-status": "dev-master",
"henrikbjorn/stampie-bundle": "^1.0",
"stof/stampie-extra": "^0.2.0",
"isinlor/buzz-bundle": "^1.0",
"ocramius/proxy-manager": "~1.0",
"beberlei/DoctrineExtensions": "^1.0",
"doctrine/doctrine-migrations-bundle": "^1.0",
"ramsey/uuid": "3.*",
"phpoffice/phpexcel": "1.8.1",
"misd/guzzle-bundle": "v1.1.5",
"php-http/guzzle6-adapter": "^1.1",
"php-http/httplug-bundle": "^1.3",
"egeloen/google-map": "2.0.x-dev",
"egeloen/google-map-bundle": "dev-master#432438624d74f0384cc727b3609af3cc4314b152",
"ezyang/htmlpurifier": "^4.8",
"tfox/mpdf-port-bundle": "1.3.*",
"ramsey/uuid-doctrine": "^1.2",
"oneup/uploader-bundle": "^1.7",
"webmozart/assert": "^1.2",
"league/tactician-bundle": "~0.4",
"kuleuven-gbiomed/message": "^0.1.0",
"danielstjules/stringy": "^3.0",
"html2text/html2text": "^4.0",
"kuleuven-gbiomed/collection-utilities": "^0.1",
"kuleuven/distribution-api": "*",
"jms/serializer": "^1",
"friendsofsymfony/rest-bundle": "^2.3"
},
"require-dev": {
"sensio/generator-bundle": "~2.3",
"kahlan/kahlan": "^3.1",
"phpunit/phpunit": "^5.7",
"doctrine/doctrine-fixtures-bundle": "^2.3",
"friendsofphp/php-cs-fixer": "^2.2",
"liip/functional-test-bundle": "^1.7",
"vimeo/psalm": "^0.3.51",
"phpmd/phpmd": "^2.6"
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\\Composer::hookRootPackageInstall"
],
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
]
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"symfony-var-dir": "var",
"symfony-bin-dir": "bin",
"symfony-tests-dir": "tests"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/Isinlor/SensioBuzzBundle.git"
},
{
"type": "vcs",
"url": "https://github.com/kuleuven-gbiomed/collection-utilities.git"
},
{
"type": "path",
"url": "distribution/API/"
}
],
"config": {
"bin-dir": "bin"
}
}
答案 0 :(得分:2)
万一它可以帮助别人,这是一个快速解决方案
事实证明,这是Windows-xampp相关的问题。 xampp仅支持32位版本的php。这又意味着它始终始终只允许将memory_limit限制为1.5G(或将2G,其中0.5G分配给其他位置)。它实际上会忽略php.ini中的任何memory_limit设置或运行时中设置的设置。通过下载64位php并从该64位php版本运行composer来解决该问题。最多可以给我3G的声音,足以运行作曲家