contao-community-alliance / composer-client

This is the Contao Composer Client
http://de.contaowiki.org/Composer
27 stars 18 forks source link

Contao 3.5.x HostEurope: "git branch --no-color --no-abbrev -v" takes too long #285

Closed reluem closed 8 years ago

reluem commented 8 years ago

edit: is this the right repo, or composer-plugin?

Composer stopped working on HostEurope WebPack Basic since approx. yesterday.

Any composer install (repository install of composer client -> composer install on a new contao 3.5.x with an empty database), or click on "Paketverwaltung" on an existing installation (with composer being installed for several weeks now), lead to the following error:

 [10-Mar-2016 13:00:04 Europe/Berlin] PHP Fatal error: Uncaught exception 'Symfony\Component\Process\Exception\ProcessTimedOutException' with message 'The process "git branch --no-color --no-abbrev -v" exceeded the timeout of 300 seconds.' thrown in phar:///is/htdocs/wp123456_5HWO9P0IN0/www/Composer/composer/composer.phar/vendor/symfony/process/Process.php on line 1192
#0 phar:///is/htdocs/wp123456_5HWO9P0IN0/www/Composer/composer/composer.phar/vendor/symfony/process/Process.php(364): Symfony\Component\Process\Process->checkTimeout()
#1 phar:///is/htdocs/wp123456_5HWO9P0IN0/www/Composer/composer/composer.phar/vendor/symfony/process/Process.php(203): Symfony\Component\Process\Process->wait()
#2 phar:///is/htdocs/wp123456_5HWO9P0IN0/www/Composer/composer/composer.phar/src/Composer/Util/ProcessExecutor.php(62): Symfony\Component\Process\Process->run(Array)
#3 phar:///is/htdocs/wp123456_5HWO9P0IN0/www/Composer/composer/composer.phar/src/Composer/Package/Version/VersionGuesser.php(88): Composer\Util\ProcessExecutor->execute('git branch --no...', NULL, '/is/htdocs/wp11...')
#4 phar:///is/htdocs/wp123456_5HWO9P0IN0/www/Composer/composer/composer.phar/src/Composer/Package/Version/VersionGuesser.php(67): Composer\Package\Version\VersionGuesser->guessGitVersion(Array, '/is/htdocs/wp11...')
#5 phar:///is/htdocs/wp123456_5HWO9P0IN0/www/Composer/composer/composer.phar/src/Composer/Package/Loader/RootPackageLoader.php(76): Composer\Package\Version\VersionGuesser->guessVersion(Array, '/is/htdocs/wp11...')
#6 phar:///is/htdocs/wp123456_5HWO9P0IN0/www/Composer/composer/composer.phar/src/Composer/Factory.php(329): Composer\Package\Loader\RootPackageLoader->load(Array, 'Composer\\Packag...', '/is/htdocs/wp11...')
#7 [internal function]: Composer\Factory->createComposer(Object(Composer\IO\BufferIO))
#8 phar:///is/htdocs/wp123456_5HWO9P0IN0/www/Composer/composer/composer.phar/src/Composer/Util/Silencer.php(67): call_user_func_array(Array, Array)
#9 /is/htdocs/wp123456_5HWO9P0IN0/www/Composer/system/modules/!composer/src/Runtime.php(556): Composer\Util\Silencer::call(Array, Object(Composer\IO\BufferIO))
#10 /is/htdocs/wp123456_5HWO9P0IN0/www/Composer/system/modules/!composer/src/ClientBackend.php(299): ContaoCommunityAlliance\Contao\Composer\Runtime::createComposer(Object(Composer\IO\BufferIO))
#11 /is/htdocs/wp123456_5HWO9P0IN0/www/Composer/system/modules/!composer/src/ClientBackend.php(125): ContaoCommunityAlliance\Contao\Composer\ClientBackend->loadComposer()
#12 /is/htdocs/wp123456_5HWO9P0IN0/www/Composer/system/modules/core/classes/Backend.php(423): ContaoCommunityAlliance\Contao\Composer\ClientBackend->generate()
#13 /is/htdocs/wp123456_5HWO9P0IN0/www/Composer/system/modules/core/controllers/BackendMain.php(131): Contao\Backend->getBackendModule('composer')
#14 /is/htdocs/wp123456_5HWO9P0IN0/www/Composer/contao/main.php(20): Contao\BackendMain->run()
#15 {main}
[10-Mar-2016 13:00:04 Europe/Berlin] 
PHP Warning: Error while sending QUERY packet. PID=16568 in /is/htdocs/wp123456_5HWO9P0IN0/www/Composer/system/modules/core/library/Contao/Database/Mysql/Statement.php on line 74
#0 [internal function]: __error(2, 'Error while sen...', '/is/htdocs/wp11...', 74, Array)
#1 /is/htdocs/wp123456_5HWO9P0IN0/www/Composer/system/modules/!composer/src/Util/ErrorHandler.php(50): call_user_func_array('__error', Array)
#2 [internal function]: ContaoCommunityAlliance\Contao\Composer\Util\ErrorHandler::handleError(2, 'Error while sen...', '/is/htdocs/wp11...', 74, Array)
#3 /is/htdocs/wp123456_5HWO9P0IN0/www/Composer/system/modules/core/library/Contao/Database/Mysql/Statement.php(74): mysql_query('UPDATE tl_user ...', Resource id #70)
#4 /is/htdocs/wp123456_5HWO9P0IN0/www/Composer/system/modules/core/library/Contao/Database/Statement.php(293): Contao\Database\Mysql\Statement->execute_query()
#5 /is/htdocs/wp123456_5HWO9P0IN0/www/Composer/system/modules/core/library/Contao/Database/Statement.php(264): Contao\Database\Statement->query()
#6 /is/htdocs/wp123456_5HWO9P0IN0/www/Composer/system/modules/core/classes/BackendUser.php(164): Contao\Database\Statement->execute('a:2:{s:7:"refer...', '1')
#7 [internal function]: Contao\BackendUser->__destruct()
#8 {main}
[10-Mar-2016 13:00:04 Europe/Berlin] PHP Fatal error:  Uncaught exception 'Exception' with message 'Query error: MySQL server has gone away (UPDATE tl_user SET session='a:2:{s:7:\"referer\";a:24:{s:8:\"1159c29a\";a:2:{s:4:\"last\";s:50:\"contao/main.php?do=repository_manager&ref=9a08f17c\";s:7:\"current\";s:50:\"contao/main.php?do=repository_catalog&ref=b9fcaf68\";}s:8:\"bcfd5432\";a:2:{s:4:\"last\";s:0:\"\";s:7:\"current\";s:37:\"contao/main.php?do=repository_catalog\";}s:8:\"b522dbb6\";a:2:{s:4:\"last\";s:0:\"\";s:7:\"current\";s:61:\"contao/main.php?do=repository_manager&install=composer.160039\";}s:8:\"9a0c192b\";a:2:{s:4:\"last\";s:0:\"\";s:7:\"current\";s:61:\"contao/main.php?do=repository_manager&install=composer.160039\";}s:8:\"dac3fab1\";a:2:{s:4:\"last\";s:0:\"\";s:7:\"current\";s:61:\"contao/main.php?do=repository_manager&install=composer.160039\";}s:8:\"8e93f87e\";a:2:{s:4:\"last\";s:0:\"\";s:7:\"current\";s:53:\"contao/main.php?do=repository_manager&update=database\";}s:8:\"221886c2\";a:2:{s:4:\"last\";s:0:\"\";s:7:\"current\";s:53:\"contao/main.php? in /is/htdocs/wp123456_5HWO9P0IN0/www/Composer/system/modules/core/library/Contao/Database/Statement.php on line 295

any suggestions on this? As I said, clean install leads to the same problem.

/composer.json

{
    "name": "contao/core",
    "type": "project",
    "description": "Contao Open Source CMS",
    "license": "LGPL-3.0+",
    "authors": [
        {
            "name": "Leo Feyer",
            "homepage": "https://github.com/leofeyer"
        }
    ],
    "require": {
        "php": ">=5.4.0",
        "leafo/scssphp": "~0.1",
        "michelf/php-markdown": "~1.4",
        "matthiasmullie/minify": "~1.3",
        "oyejorge/less.php": "~1.7",
        "phpspec/php-diff": "~1.0",
        "simplepie/simplepie": "~1.3",
        "swiftmailer/swiftmailer": "^5.2.1",
        "tecnickcom/tcpdf": "~6.0",
        "true/punycode": "~1.0",
        "contao-components/compass": "~0.12"
    }
}

/composer/composer.json:

{
    "name": "local/website",
    "description": "A local website project",
    "type": "project",
    "license": "proprietary",
    "require": {
        "contao-community-alliance/composer-client": "~0.12"
    },
    "prefer-stable": true,
    "minimum-stability": "dev",
    "config": {
        "preferred-install": "dist",
        "cache-dir": "cache",
        "component-dir": "../assets/components"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://legacy-packages-via.contao-community-alliance.org/"
        },
        {
            "type": "artifact",
            "url": "packages"
        },
        {
            "type": "composer",
            "url": "http://legacy-packages-via.contao-community-alliance.org/"
        }
    ]
}```
fritzmg commented 8 years ago

You should post code blocks either with indent or with triple backticks.

reluem commented 8 years ago

@fritzmg updated, sorry

discordier commented 8 years ago

Do you have shell access on that machine? The problem on your side is, that git takes more than 300 seconds to complete the command

git branch --no-color --no-abbrev -v

which should complete in around some milliseconds normally.

The MySQL problem is a follow up problem totally unrelated to this problem. Contao tries to save the session in the destructor which fails as the MySQL server has already closed the connection due to inactivity, it does so around 1 minute on average shared hosters.

reluem commented 8 years ago

no shell access on this system unfortunately.

a clone (database and Contao) of the running system on a different server (netcup), however, did work without problems.

Any way that I could (similarly to the #134 approach) use the netcup server, perform the git branch command and then copy back (and make it work on HE again)?

discordier commented 8 years ago

This will not work. You will get the correct vendor dir, however, all the symlinks will be missing. You have to fix your installation (and find out why git takes so long on your machine). Could you try to increase the composer log level in the Contao Settings and provide us with a complete transcript? Also, have you tried the detached mode?

reluem commented 8 years ago

okay.

I only see the normal error log. Is there a way to see a .log for composer on the server? The debug log setting did not have any effect on error.log.

Same with subprocess mode and standalone: HE' php path according to the FAQs /usr/bin/php -d memory_limit=128M -d max_execution_time=60

no change at all..

discordier commented 8 years ago

No change at all????? When running stand alone, there MUST be something changed. And if it only is that you get a timeout and when going back to composer that you get a console window.

the linked page above seems suspicious to me:

Ein Pfad zu php wird in der Regel jedoch nur für CronJobs benötigt, da "normale" PHP Skripte von mod_php ausgeführt werden.

I doubt they are still running on mod_php in 2016, if they really do: CHANGE HOSTING, DRAGONS AHEAD! :dragon:

Maybe you have some entry in system/logs/error.log telling you that the process could not be spawned. To put long story short, I have no clue what hosting environment is available at HE as I have never used them.

reluem commented 8 years ago

just to be sure: I cannot access the composer inside Contao at all! /contao/main.php?do=composer throws the exception, I don't see the usual console window.

I did a phpinfo on HE: Server API Apache 2.0 Handler

Change hosting is the medium/long-term goal. ATM, however, functionality (as it was last week) would be preferred...

HE-Support did not really help (PHP version: PHP Version 5.6.18-1~he.0):

Die einzige Änderung diese Woche ist die Deaktivierung von PHP5.3. Alle Domains die bis Dienstag PHP5.3 verwendet haben wurden von uns auf PHP5.6 umgestellt.

they offered, however, to follow a routine that triggers this error:

Bitte nennen Sie uns einen reproduzierbaren Weg - wir prüfen dann gerne ob es sich um einen Serverfehler oder einen Fehler in Ihren Skripten handelt.

Any ideas how they could reproduce the git-Error and maybe resolve the issue?

discordier commented 8 years ago

Reproducing this would involve debugging the problem onsite in your hosting package and detecting the settings needed to run composer and to inspect what versions of PHP you have running and what the config is. Sadly I lack the time to do this right now.

The php info you provided above indeed does imply having PHP running as mod_php which is pretty rare on shared hosting nowadays. Any chance you can change it to run as cgi?

My steps to troubleshoot would be:

  1. create minimal test script to check if proc_open calls are executed correctly.
  2. create minimal test script to check if git can be executed and does not block.
  3. create minimal test script to check if above git command can be exectuted correctly.
rabauss commented 8 years ago

did someone find a solution for problems with composer on HE WebHosting Basic?

reluem commented 8 years ago

proc_open and git are available according to the composer-check. Unfortunately, I don't have the relevant skills to do troubleshooting myself.

Up to this date, composer functionality is still not given.

@rabauss, did you encounter similar problems?

rabauss commented 8 years ago

i think i have a solution the problem is that newest composer.phar is always searching for the version of composer.json via git. but git is not available as command in hosteurope-webpacks - so it ends with timeout!

you have to add the version-property manually into the contao-root/composer/composer.json https://getcomposer.org/doc/04-schema.md#version

{ "name": "local/website", "description": "A local website project", "version": "1.0.0", "type": "project", "license": "proprietary", "require": { ......

also you should replace the composer.phar in contao-root/composer/ with the newest version (at the moment version 1.0.2) -- you need also #288

finally i recommend to change contao localconfig for composer. set execution to detached for no php-limits - and disable auto-update $GLOBALS['TL_CONFIG']['composerExecutionMode'] = 'detached'; $GLOBALS['TL_CONFIG']['composerVerbosity'] = 'VERBOSITY_NORMAL'; $GLOBALS['TL_CONFIG']['composerPhpPath'] = '/usr/bin/php -d memory_limit=1G -d max_execution_time=900 -d suhosin.executor.include.whitelist="http://,https://,phar" -d allow_url_fopen'; $GLOBALS['TL_CONFIG']['composerAutoUpdateLibrary'] = false;

reluem commented 8 years ago

yes, this was the solution! Perfect, thank you so much!

edit: worked perfectly until I updated to the phar version you mentioned above!

$ /usr/bin/php -d memory_limit=1G -d suhosin.executor.include.whitelist="http://,https://,phar" -d allow_url_fopen composer.phar update --no-ansi --no-interaction -vvv --profile
Unable to create lock file:  Permission denied
Failed to start up concurrent users module!
Running 5c9c9102400dc4e38b8ea91074f22c7014050159 (2016-04-24 14:55:55) with PHP 5.6.20-1~he.0 on Linux / 3.10.5-he-wp2005-x64+6+

Fatal error: Call to a member function writeError() on null in phar:///is/htdocs/wp1162560_5HWO9P0IN0/www/kinderweihnacht/composer/composer.phar/src/Composer/Console/Application.php on line 163
zend_mm_heap corrupted

going back to older version makes it work again!

any suggestions regarding this?

discordier commented 8 years ago

Please try the solutions suggested at http://stackoverflow.com/questions/2247977/what-does-zend-mm-heap-corrupted-mean

rabauss commented 8 years ago

after getting into composer-extension without timeout, I also had some trouble with phar.

  1. solved #288 + manual update to composer.phar 1.0.2
  2. deleted vendor-folder from contao-root/composer/vendor and did composer update
  3. had to do 1. again - because bug was replaced with update from 2.
zonky2 commented 7 years ago

I have the same error

[15-Feb-2017 18:48:03 Europe/Berlin] PHP Fatal error: Uncaught exception 'Symfony\Component\Process\Exception\ProcessTimedOutException' with message 'The process "git branch --no-color --no-abbrev -v" exceeded the timeout of 300 seconds.' thrown in phar:///is/htdocs/wp12345_WNDYR8W5HX/www/my_page/composer/composer.phar/vendor/symfony/process/Process.php on line 1198
#0 phar:///is/htdocs/wp12345_WNDYR8W5HX/www/my_page/composer/composer.phar/vendor/symfony/process/Process.php(361): Symfony\Component\Process\Process->checkTimeout()
#1 phar:///is/htdocs/wp12345_WNDYR8W5HX/www/my_page/composer/composer.phar/vendor/symfony/process/Process.php(203): Symfony\Component\Process\Process->wait()
#2 phar:///is/htdocs/wp12345_WNDYR8W5HX/www/my_page/composer/composer.phar/src/Composer/Util/ProcessExecutor.php(68): Symfony\Component\Process\Process->run(Array)
#3 phar:///is/htdocs/wp12345_WNDYR8W5HX/www/my_page/composer/composer.phar/src/Composer/Package/Version/VersionGuesser.php(94): Composer\Util\ProcessExecutor->execute('git branch --no...', NULL, '/is/htdocs/wp10...')
#4 phar:///is/htdocs/wp12345_WNDYR8W5HX/www/my_page/composer/composer.phar/src/Composer/Package/Version/VersionGuesser.php(67): Composer\Package\Version\VersionGuesser->guessGitVersion(Array, '/is/htdocs/wp10...')
#5 phar:///is/htdocs/wp12345_WNDYR8W5HX/www/my_page/composer/composer.phar/src/Composer/Package/Loader/RootPackageLoader.php(76): Composer\Package\Version\VersionGuesser->guessVersion(Array, '/is/htdocs/wp10...')
#6 phar:///is/htdocs/wp12345_WNDYR8W5HX/www/my_page/composer/composer.phar/src/Composer/Factory.php(348): Composer\Package\Loader\RootPackageLoader->load(Array, 'Composer\\Packag...', '/is/htdocs/wp10...')
#7 /is/htdocs/wp12345_WNDYR8W5HX/www/my_page/system/modules/!composer/src/Runtime.php(585): Composer\Factory->createComposer(Object(Composer\IO\BufferIO))
#8 /is/htdocs/wp12345_WNDYR8W5HX/www/my_page/system/modules/!composer/src/ClientBackend.php(300): ContaoCommunityAlliance\Contao\Composer\Runtime::createComposer(Object(Composer\IO\BufferIO))
#9 /is/htdocs/wp12345_WNDYR8W5HX/www/my_page/system/modules/!composer/src/ClientBackend.php(125): ContaoCommunityAlliance\Contao\Composer\ClientBackend->loadComposer()
#10 /is/htdocs/wp12345_WNDYR8W5HX/www/my_page/system/modules/core/classes/Backend.php(423): ContaoCommunityAlliance\Contao\Composer\ClientBackend->generate()
#11 /is/htdocs/wp12345_WNDYR8W5HX/www/my_page/system/modules/core/controllers/BackendMain.php(131): Contao\Backend->getBackendModule('composer')
#12 /is/htdocs/wp12345_WNDYR8W5HX/www/my_page/contao/main.php(20): Contao\BackendMain->run()
#13 {main}

on HostEurope WebPack L with Contao 3.5.24 ... I work allone at the backend and I updated all packages for few days (~09.2.17 ?)

If I click at icon "package manager" and wait five minutes response a error.

any older composer.phar don´t fix the problem

discordier commented 7 years ago

You did try adding the version key as suggested by @rabauss in https://github.com/contao-community-alliance/composer-client/issues/285#issuecomment-214057249 ?

zonky2 commented 7 years ago

W O W ! ! !

... and it´s running with

"version": "1.0.0",