Giter Club home page Giter Club logo

Comments (9)

Seldaek avatar Seldaek commented on May 20, 2024 1

100 it is ;)

The CI failure is just php 8.4.

from composer.

Seldaek avatar Seldaek commented on May 20, 2024

I cannot reproduce this..

$ composer update
Loading composer repositories with package information
https://repo.packagist.org could not be fully loaded (curl error 7 while downloading https://repo.packagist.org/packages.json: ), package information was loaded from the local cache and may be out of date

In CurlDownloader.php line 372:

  curl error 7 while downloading https://repo.packagist.org/p2/arcanedev/log-viewer.json:


update [--with WITH] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-dev] [--lock] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [--no-autoloader] [--no-suggest] [--no-progress] [-w|--with-dependencies] [-W|--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-m|--minimal-changes] [-i|--interactive] [--root-reqs] [--] [<packages>...]

$ echo $?
1

Maybe your CI or whatever you use to call composer there is swallowing the exit code?

from composer.

bilogic avatar bilogic commented on May 20, 2024

@Seldaek my bad, I found the culprit swallowing the exit code. Thank you!

from composer.

bilogic avatar bilogic commented on May 20, 2024

@Seldaek on a related note, is there a way to specify retries after a backoff period? I get connection issues often enough to warrant retries.

The exit code 1 isn't enough for me to know that it is a packagist connection issue to script a retry, and also because every CI failure leads to notifying the whole team, I don't want them to become accustomed to these false alarms.

I found this #10161, seems retry is built-in and automatic?

https://github.com/composer/composer/blob/bcab1c4b8ecf7b239dd9e08fc07c5458cf80cb0a/src/Composer/Util/Http/CurlDownloader.php can't quite see if there is a backoff period.

from composer.

Seldaek avatar Seldaek commented on May 20, 2024

There is backoff here

private function restartJobWithDelay(array $job, string $url, array $attributes): void

I fixed the return code now so it should use 255 for http/curl errors.

from composer.

bilogic avatar bilogic commented on May 20, 2024

@Seldaek as usual, I really appreciate your openness to suggestions and feedback.

I did some quick googling for standardized exit codes and it would appear 255 and some others are reserved https://tldp.org/LDP/abs/html/exitcodes.html#AEN23549

  1. https://www.cyberciti.biz/faq/linux-bash-exit-status-set-exit-statusin-bash/ not sure what this is based on, but it has 100-104 for network problems
  2. https://stackoverflow.com/a/1535733/3872647 there is 68 and 76

Would you like me to look for a suitable number?

from composer.

bilogic avatar bilogic commented on May 20, 2024

private function restartJobWithDelay(array $job, string $url, array $attributes): void
{
if ($attributes['retries'] >= 3) {
usleep(500000); // half a second delay for 3rd retry and beyond
} elseif ($attributes['retries'] >= 2) {
usleep(100000); // 100ms delay for 2nd retry
} // no sleep for the first retry

The backoff seems to be too small to deal with rate limiting, at least that is what I assume packagist was doing. I was thinking on the order of up to 30-60 seconds.

But no big deal, if the appropriate exit code is returned, I will handle these customized timeouts myself. Thank you.

from composer.

Seldaek avatar Seldaek commented on May 20, 2024

Packagist should not do rate limiting no, so I'm not sure why these failures occur.

Unfortunately I cannot really set a code <255 without breaking a bunch of internal code relying on the exception codes being http codes.

Exception::getCode is final so I can't do hackery there to return another code when symfony/console's Application class requests it. So I had to resort to another level of hackery.. but 762f2a3 should do the job.

from composer.

bilogic avatar bilogic commented on May 20, 2024

Ok, 255 it is. Thank you!

Wait, it appears 762f2a3 will return 100, but what does that red X mean? I thought the CI failed?

from composer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.