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
Have a non-zero exit code when curl fails #11954
Comments
I cannot reproduce this..
Maybe your CI or whatever you use to call composer there is swallowing the exit code? |
@Seldaek my bad, I found the culprit swallowing the exit code. Thank you! |
@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. |
There is backoff here
I fixed the return code now so it should use 255 for http/curl errors. |
@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
Would you like me to look for a suitable number? |
composer/src/Composer/Util/Http/CurlDownloader.php Lines 615 to 622 in bcab1c4
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. |
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. |
Wait, it appears 762f2a3 will return 100, but what does that red X mean? I thought the CI failed? |
100 it is ;) The CI failure is just php 8.4. |
I'm running
composer update
in my ci/cd action file.Sometimes,
curl
fails (see image), but it would appear composer exits with0
code (which is why theSetup dependencies with composer
has a green tick.Possible to exit with a non-zero instead?
My
composer.json
:...replace me...
Output of
composer diagnose
:When I run this command:
I get the following output:
And I expected this to happen:
a non-zero exit code
The text was updated successfully, but these errors were encountered: