Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git clone process does not respect ~/.composer/config.json or COMPOSER_PROCESS_TIMEOUT #3946

Closed
sethfischer opened this issue Apr 18, 2015 · 1 comment

Comments

@sethfischer
Copy link

The git clone process does not respect ~/.composer/config.json or
environment variable COMPOSER_PROCESS_TIMEOUT. Time-out is fixed at 300s.

300s is the default value in class ProcessExecutor.

class ProcessExecutor
{
    protected static $timeout = 300;

    protected $captureOutput;

Changing the default value of ProcessExecutor->timeout to a high value allows
the successful execution of the commands below.

Composer and php versions:

$ composer --version
Composer version 1.0-dev (921b3a0eba139820716f7aeefb553197c14656d8) 2015-04-15 18:27:04
$ php --version
PHP 5.4.39-0+deb7u2 (cli) (built: Mar 25 2015 08:33:29) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

Global config process-timeout set to 100000s.

$ cat ~/.composer/config.json 
{
    "config": {
        "process-timeout": 100000}
}

The git clone process times-out after 300s.

$ time composer create-project drupal/drupal drupal 8.0.*@dev
Installing drupal/drupal (8.0.x-dev cbc03163b937bd6c5de70ed88cee062286680431)
  - Installing drupal/drupal (8.0.x-dev cbc0316)
    Cloning cbc03163b937bd6c5de70ed88cee062286680431

  [Symfony\Component\Process\Exception\ProcessTimedOutException]               
  The process "git clone --no-checkout 'http://git.drupal.org/project/drupal.  
  git' 'drupal/' && cd 'drupal/' && git remote add composer 'http://git.drupa  
  l.org/project/drupal.git' && git fetch composer" exceeded the timeout of 30  
  0 seconds.                                                                   

create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repository-url="..."] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [package] [directory] [version]

real    6m15.607s
user    0m1.136s
sys 0m0.116s

Set environment variable COMPOSER_PROCESS_TIMEOUT to 100000s. The git clone
process times-out after 300s.

$ export COMPOSER_PROCESS_TIMEOUT=100000
$ echo $COMPOSER_PROCESS_TIMEOUT100000
$ time composer create-project drupal/drupal drupal 8.0.*@dev
Installing drupal/drupal (8.0.x-dev cbc03163b937bd6c5de70ed88cee062286680431)
  - Installing drupal/drupal (8.0.x-dev cbc0316)
    Cloning cbc03163b937bd6c5de70ed88cee062286680431

  [Symfony\Component\Process\Exception\ProcessTimedOutException]               
  The process "git clone --no-checkout 'http://git.drupal.org/project/drupal.  
  git' 'drupal/' && cd 'drupal/' && git remote add composer 'http://git.drupa  
  l.org/project/drupal.git' && git fetch composer" exceeded the timeout of 30  
  0 seconds.                                                                   

create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repository-url="..."] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [package] [directory] [version]

real    5m22.282s
user    0m0.988s
sys 0m0.116s

The command was successfully executed by modifying the following line:

class ProcessExecutor
{
    protected static $timeout = 100000; # replaced 300 with a high value

    protected $captureOutput;

Output with above modification:

$ time ~/projects/composer/bin/composer create-project drupal/drupal drupal 8.0.*@dev
Installing drupal/drupal (8.0.x-dev cbc03163b937bd6c5de70ed88cee062286680431)
  - Installing drupal/drupal (8.0.x-dev cbc0316)
    Cloning cbc03163b937bd6c5de70ed88cee062286680431

Created project in drupal
Loading composer repositories with package information
Installing dependencies (including require-dev)
  # ...
Writing lock file
Generating autoload files
Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]? y

real    17m43.599s
user    0m29.718s
sys 0m9.485s
@alcohol
Copy link
Member

alcohol commented Apr 20, 2015

Hrm, you sure the config setting did not help?

This is the only place I could find it being used:
https://github.com/composer/composer/blob/master/src/Composer/Factory.php#L254

I'll have a PR available in a minute regardless.

alcohol added a commit to alcohol/composer that referenced this issue Apr 20, 2015
Use COMPOSER_PROCESS_TIMEOUT if available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants