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

RingdownCurlHttpClient removes unavailable hosts too aggressively #443

Open
lukaslangen opened this issue Jan 27, 2025 · 0 comments · May be fixed by #444
Open

RingdownCurlHttpClient removes unavailable hosts too aggressively #443

lukaslangen opened this issue Jan 27, 2025 · 0 comments · May be fixed by #444
Assignees

Comments

@lukaslangen
Copy link

Summary

The RingdownCurlHttpClient declares hosts as "unavailable" if they give a response with a status code >= 400, or if something else goes entirely wrong, i.e. the inner client throws an HttpException.

This is fine, as long as only one phar to install is given.
It becomes an issue, as soon as one wants to install multiple phars at once on a fresh system and the first phar has its key stored on keyserver.ubuntu.com exclusively and the next phar has its key exclusively stored on keys.openpgp.org.

Phive will try to get the first key from keys.openpgp.org but will get a 404 status code and then declare keys.openpgp.org as unavailable, thus removing it from its internal host list. It will then succeed in fetching the key from keyserver.ubuntu.com.
When trying to download the key for the next phar, phive never tries to fetch the key from keys.openpgp.org, but only from keyserver.ubuntu.com, which fails, as it doesn't exist.

Steps to reproduce

For the reproduction, I used the official docker image, which uses phive in version 0.15.2, but I also verified it with our internal docker images, which use phive in version 0.15.3. I can't share them publicly, though.

  1. Create a new directory and install php-cs-fixer and phpstan with phive
  2. Remove the tools directory
  3. Execute docker run -it --rm -v pwd:/repo phario/phive:0.15.2 install --trust-gpg-keys E82B2FB314E9906E,51C67305FFC2E5C0

Output of the docker command:

$ docker run -it --rm -v `pwd`:/repo  phario/phive:0.15.2 install --trust-gpg-keys E82B2FB314E9906E,51C67305FFC2E5C0
Phive 0.15.2-8-g05a4851 - Copyright (C) 2015-2025 by Arne Blankerts, Sebastian Heuer and Contributors
Fetching repository list
Downloading https://phar.io/data/repositories.xml
Downloading https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/releases?per_page=100
Downloading https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v3.62.0/php-cs-fixer.phar
Downloading https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v3.62.0/php-cs-fixer.phar.asc
Downloading key E82B2FB314E9906E
Trying to connect to keys.openpgp.org (37.218.245.50)
Downloading https://keys.openpgp.org/pks/lookup?op=get&options=mr&search=0xE82B2FB314E9906E
Trying to connect to keys.openpgp.org (2a00:c6c0::154:1:0:0:1)
[ERROR]   Request failed:  (while requesting https://keys.openpgp.org/pks/lookup?op=get&options=mr&search=0xE82B2FB314E9906E)
[WARNING] Failed with error code 404: Key not found on keyserver
Trying to connect to keyserver.ubuntu.com (185.125.188.26)
Successfully downloaded key.

        Fingerprint: BBAB 5DF0 A0D6 6729 89CF 1869 E82B 2FB3 14E9 906E

        Dariusz Ruminski <[email protected]>

        Created: 2015-01-17

Copying php-cs-fixer-3.62.0.phar to /repo/tools/php-cs-fixer
Downloading https://github.com/phpstan/phpstan/releases/download/2.1.2/phpstan.phar
Downloading https://github.com/phpstan/phpstan/releases/download/2.1.2/phpstan.phar.asc
Downloading key 51C67305FFC2E5C0
[WARNING] Failed with error code 0: No mirror yielded any result. Giving up.
Trying to connect to keyserver.ubuntu.com (185.125.188.26)
Downloading https://keyserver.ubuntu.com/pks/lookup?op=get&options=mr&search=0x51C67305FFC2E5C0
Trying to connect to keyserver.ubuntu.com (185.125.188.27)
Downloading https://keyserver.ubuntu.com/pks/lookup?op=get&options=mr&search=0x51C67305FFC2E5C0
Trying to connect to keyserver.ubuntu.com (2620:2d:4000:1007::d43)
[ERROR]   Request failed:  (while requesting https://keyserver.ubuntu.com/pks/lookup?op=get&options=mr&search=0x51C67305FFC2E5C0)
Trying to connect to keyserver.ubuntu.com (2620:2d:4000:1007::70c)
[ERROR]   Request failed:  (while requesting https://keyserver.ubuntu.com/pks/lookup?op=get&options=mr&search=0x51C67305FFC2E5C0)
[WARNING] Failed with error code 404: Key not found on keyserver
Trying to connect to pgp.mit.edu (18.9.60.141)
Downloading https://pgp.mit.edu/pks/lookup?op=get&options=mr&search=0x51C67305FFC2E5C0
[WARNING] Failed with error code 502: Server reported an error
[ERROR]   PublicKey 51C67305FFC2E5C0 not found on key servers

Although I used phive with its --trust-gpg-keys option, the issue persists without the option as well.

@theseer theseer self-assigned this Jan 27, 2025
@lukaslangen lukaslangen linked a pull request Jan 27, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants