delete
delete

Reputation: 19148

Composer install hangs at ScriptHandler::buildBootstrap

Sometimes, not every time, but with increasing tendency, i discover the following behaviour with composer install on a symfony project. We are working with different branches here and after switching from a feature branch back to the master, a composer install is necessary. Everything works fine, but at the last step, the script terminates after 300 sec while "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]

After this error occured once, it is not possible any more to execute composer without hanging directly at the beginning.

$> php -d memory_limit=-1 composer.phar -vvv install 

this will hang directly after pressing enter, no output, nothing. I reboot then the machine and maybe the next time is working, and sometimes not like described above.

Has anyone discovered the same thing?

Upvotes: 1

Views: 3321

Answers (3)

itinance
itinance

Reputation: 12388

ScriptHandler::buildBootstrap is the very first task at composer which executes code in your symfony project. This means, the php task is waiting for something and there are not so many things which could be in consideration here.

Are you simultaneously debugging with xdebug (mayby with a forgotten debug-session)? Is xdebug running in a debug session and waiting at a break point?

This could be the root cause.

Upvotes: 12

Denis Rendler
Denis Rendler

Reputation: 182

One fix I found is to disable the xdebug for the CLI. The Composer project mentions this fix and also alias the php keyword and start the xdebug library only when using the php command. More details here: https://getcomposer.org/doc/articles/troubleshooting.md#xdebug-impact-on-composer

Upvotes: 0

tftd
tftd

Reputation: 17032

The error you're receiving is stating that the time limit for executing the script has been exceeded. Defining -d memory_limit=-1 will only remove any memory limits. What you should do is to add -d max_execution_time=0 (docs). That should fix your problem.

Upvotes: 0

Related Questions