有时候,不是每次,但随着趋势的增加,我会在symfony项目中发现作曲家安装的以下行为。 我们在这里与不同的分支机构合作,在从功能分支切换回主分支后,需要进行作曲家安装。 一切正常,但在最后一步,脚本在300秒后终止,而“buildBootstrap”。
> post-update-cmd: Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap handling the post-update-cmd event terminated with an exception
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "'/usr/bin/php5' '--php-ini=/etc/php5/cli/php.ini' '/var/www/Project/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/../Resources/bin/build_bootstrap
.php' 'app' 'app' " exceeded the timeout of 300 seconds.
Exception trace:
() at phar:///var/www/Project/composer.phar/vendor/symfony/process/Symfony/Component/Process/Process.php:1219
Symfony\Component\Process\Process->checkTimeout() at phar:///var/www/Project/composer.phar/vendor/symfony/process/Symfony/Component/Process/Process.php:356
Symfony\Component\Process\Process->wait() at phar:///var/www/Project/composer.phar/vendor/symfony/process/Symfony/Component/Process/Process.php:210
Symfony\Component\Process\Process->run() at /var/www/Project/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:454
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::executeBuildBootstrap() at /var/www/Project/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:82
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap() at phar:///var/www/Project/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:211
Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///var/www/Project/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:167
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///var/www/Project/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:92
Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///var/www/Project/composer.phar/src/Composer/Installer.php:346
Composer\Installer->run() at phar:///var/www/Project/composer.phar/src/Composer/Command/UpdateCommand.php:143
Composer\Command\UpdateCommand->execute() at phar:///var/www/Project/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
Symfony\Component\Console\Command\Command->run() at phar:///var/www/Project/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand() at phar:///var/www/Project/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at phar:///var/www/Project/composer.phar/src/Composer/Console/Application.php:147
Composer\Console\Application->doRun() at phar:///var/www/Project/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at phar:///var/www/Project/composer.phar/src/Composer/Console/Application.php:82
Composer\Console\Application->run() at phar:///var/www/Project/composer.phar/bin/composer:43
require() at /var/www/Project/composer.phar:25
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [packages1] ... [packagesN]
发生此错误一次后,再也无法在不直接挂起的情况下执行编辑器。
$> php -d memory_limit=-1 composer.phar -vvv install
按下回车后会直接挂起,没有输出,没有。我重新启动机器,可能下次工作,有时候不像上面描述的那样。
有没有人发现过同样的事情?
答案 0 :(得分:11)
ScriptHandler :: buildBootstrap是composer中第一个在symfony项目中执行代码的任务。这意味着,php任务正在等待某些事情,而且这里没有太多可以考虑的事情。
您是否同时使用xdebug进行调试(mayby使用忘记的调试会话)? xdebug是否在调试会话中运行并在断点处等待?
这可能是根本原因。
答案 1 :(得分:0)
您收到的错误表明已超出执行脚本的时间限制。定义-d memory_limit=-1
只会删除任何内存限制。您应该做的是添加-d max_execution_time=0
(docs)。这应该可以解决你的问题。
答案 2 :(得分:0)
我发现的一个修复是禁用CLI的xdebug。 Composer项目提到了这个修复,并且也是php关键字的别名,只有在使用php命令时才启动xdebug库。 更多详情:https://getcomposer.org/doc/articles/troubleshooting.md#xdebug-impact-on-composer