deployer icon indicating copy to clipboard operation
deployer copied to clipboard

composer create-project killed only _under_ deployer, ok with pure ssh

Open lucatrev opened this issue 10 years ago • 4 comments

Q A
Issue Type Question
Deployer Version master
Local Machine OS Win8.1 (tested also with vagrant(ubuntu))
Remote Machine OS ubuntu on vagrant vs ubuntu on dreamhost

Description

I am trying to translate my old deployment script to deployer. In a specific point i need to run on deployment server:

composer create-project --prefer-dist cakephp/app /home/***/***/***/prod/releases/20160412233742

(stars are there to hide sensible informations)

✔ Running command using deployer with dev vagrant/ubuntu machine as remote -> all is ok there ✔ Running command using ssh (PuTTY or KiTTY, copy and paste command in the terminal) connected with the production dreamhost/ubuntu machine -> all is fine ➤ Running command using deployer with production dreamhost/ubuntu machine as remote (the same used with pure ssh) i got a runtime exception after a few seconds (5-10 in avg), with different composer command output at each run (sometimes it install something more, sometimes something less.. this is random, not the same point every time) -> Killed, task not completed :(

Steps to reproduce

Content of deploy.php

[..]
run('{{bin/composer}} create-project --prefer-dist cakephp/app {{release_path}}');
[..]

Output log

 [RuntimeException]
  bash: line 1: 22614 Killed                  /usr/local/php56/bin/php /home/***/***/***/prod/composer.phar create-project --prefer-dist cakephp/app /home/***/***/***/prod/releases/20160412233742

Exception trace:
 () at deployer\src\Server\Remote\PhpSecLib.php:114
 Deployer\Server\Remote\PhpSecLib->run() at deployer\src\functions.php:297
 run() at deployer\deploy.php:148
 {closure}() at n/a:n/a
 call_user_func() at deployer\src\Task\Task.php:79
 Deployer\Task\Task->run() at deployer\src\Executor\SeriesExecutor.php:43
 Deployer\Executor\SeriesExecutor->run() at deployer\src\Console\TaskCommand.php:82
 Deployer\Console\TaskCommand->execute() at deployer\vendor\symfony\console\Command\Command.php:256
 Symfony\Component\Console\Command\Command->run() at deployer\vendor\symfony\console\Application.php:791
 Symfony\Component\Console\Application->doRunCommand() at deployer\vendor\symfony\console\Application.php:186
 Symfony\Component\Console\Application->doRun() at deployer\vendor\symfony\console\Application.php:117
 Symfony\Component\Console\Application->run() at deployer\src\Deployer.php:101
 Deployer\Deployer->run() at deployer\bin\dep:64

Verbose output log

This is another run with -vvv on composer:

[RuntimeException]
  Checking CA file /etc/ssl/certs/ca-certificates.crt
  Downloading https://packagist.org/packages.json
  Writing /home/***/.composer/cache/repo/https---packagist.org/packages.js on into cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/p-provider-2013.json from cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/p-provider-2014.json from cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/p-provider-2015.json from cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/p-provider-2015-07.json from cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/p-provider-2015-10.json from cache
  Downloading http://packagist.org/p/provider-2016-01%24f302f0bb60341aadd779369362fc11d0be29039cb0e08e79ea9e3d20ebec4ae8.json
  Writing /home/***/.composer/cache/repo/https---packagist.org/p-provider-2016-01.json into cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/p-provider-2016-04.json from cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/p-provider-archived.json from cache
  Downloading http://packagist.org/p/provider-latest%24f223b6a95bbb47526d6fb6cb7d329191f6e09c4525d0ae4223c2356513d393fc.json
  Writing /home/***/.composer/cache/repo/https---packagist.org/p-provider-latest.json into cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/provider-cakephp$app.json from cache
  Installing cakephp/app (3.2.4)
    - Installing cakephp/app (3.2.4)
  Reading /home/***/.composer/cache/files/cakephp/app/27c46c41f4005f6d37726f7e85a74d74c750204d.zip from cache
      Loading from cache
      Extracting archive
  Executing command (CWD): unzip '/home/***/***/***/prod/releases/20160412225836//490d524e1e2d69fa633f2b2bf94343d9' -d '/home/***/***/***/prod/releases/20160412225836/vendor/composer/c1e8ba97' && chmod -R u+w '/home/***/***/***/prod/releases/20160412225836/vendor/composer/c1e8ba97'
  bash: line 1:  8508 Killed                  /usr/local/php56/bin/php /home/***/***/***/prod/composer.phar create-project --prefer-dist cakephp/app /home/***/***/***/prod/releases/20160412225836 -n -vvv

Again, another one:

 [RuntimeException]
  Checking CA file /etc/ssl/certs/ca-certificates.crt
  Downloading https://packagist.org/packages.json
  Writing /home/***/.composer/cache/repo/https---packagist.org/packages.js on into cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/p-provider-2013.json from cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/p-provider-2014.json from cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/p-provider-2015.json from cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/p-provider-2015-07.json from cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/p-provider-2015-10.json from cache
  Downloading http://packagist.org/p/provider-2016-01%2408733b24493e1d9e452a4f1b56b07f260158e90acf494fd749adb77ea673e4f6.json
  Writing /home/***/.composer/cache/repo/https---packagist.org/p-provider-2016-01.json into cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/p-provider-2016-04.json from cache
  Reading /home/***/.composer/cache/repo/https---packagist.org/p-provider-archived.json from cache
  bash: line 1:  7469 Killed                  /usr/local/php56/bin/php /home/***/***/***/prod/composer.phar create-project --prefer-dist cakephp/app /home/***/***/***/prod/releases/20160412225557 -n -vvv

Any suggestions? Please let me know if there are other infos i have to share...

PS: Thanks for deployer... xD

lucatrev avatar Apr 12 '16 22:04 lucatrev

It's looks like some one killing php exec on prod. Users are same?

antonmedv avatar Apr 14 '16 03:04 antonmedv

Can you try run a task?

task('test_kill_php', function(){
     run('{{bin/php}} -r "sleep(10); echo \"Done\";"');
});

oanhnn avatar Apr 14 '16 04:04 oanhnn

@elfet yes, they are the same

@oanhnn i will try it in a few hours, you are thinking to some execution timeout..

lucatrev avatar Apr 14 '16 12:04 lucatrev

@oanhnn trying your suggestion i got:

$ dep test_kill_php production
✔ Executing task test_kill_php

..and verbosely:

$ dep test_kill_php production -vvv
➤ Executing task test_kill_php
↳ on [dreamhost.prod]
> cd /home/***/***/***/prod && /usr/local/php56/bin/php -r "sleep(10); echo \"Done\";"
< Done
• done on [dreamhost.prod]
✔ Ok [12s 940ms]

It is not a php timeout issue.. i also tested php -i > infos.log and php --ini > ini.log both with pure ssh and with deployer same parameters..

UPDATE Writing the comment and looking for resource usage with top i found a lot of ssh-agent instances due to .bash_profile; killing that instances and all the ssh-agent stuff now deployer works like a charm. I will keep investigating on this, but i will close this issue because it seems something wrong with my configuration (even if it is wrong ONLY with deployer). If a better analysis will give me a general solution/explanation i will keep you updated. Sorry for wasting your time.

Long life to deployer, really a peace of mind for devs!!!

lucatrev avatar Apr 14 '16 17:04 lucatrev