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

Cargo failed to download crates with https_proxy #11746

Closed
akiirui opened this issue Feb 21, 2023 · 8 comments · Fixed by #11871
Closed

Cargo failed to download crates with https_proxy #11746

akiirui opened this issue Feb 21, 2023 · 8 comments · Fixed by #11871
Labels
A-networking Area: networking issues, curl, etc. C-bug Category: bug S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

Comments

@akiirui
Copy link

akiirui commented Feb 21, 2023

Problem

Cargo failed to download crates when I set https_proxy=http://127.0.0.1:1081/:

$ cargo build
error: failed to download from `https://crates.io/api/v1/crates/want/0.3.0/download`

Caused by:
  [2] Failed initialization ([CONN-1-0] send: no filter connected)

Steps

  1. Set https_proxy environment varable
  2. git clone https://github.com/Morganamilo/paru.git
  3. cd paru
  4. cargo build

Possible Solution(s)

No response

Notes

Logs with CARGO_HTTP_DEBUG=true and CARGO_LOG=cargo::ops::registry=trace

[2023-02-21T06:45:03Z DEBUG cargo::ops::registry] http-debug: * Uses proxy env variable no_proxy == 'localhost,127.0.0.0/8,::1'
[2023-02-21T06:45:03Z DEBUG cargo::ops::registry] http-debug: * Uses proxy env variable https_proxy == 'http://127.0.0.1:1081/'
[2023-02-21T06:45:03Z DEBUG cargo::ops::registry] http-debug: *   Trying 127.0.0.1:1081...
---
[2023-02-21T06:45:03Z DEBUG cargo::ops::registry] http-debug: * Uses proxy env variable no_proxy == 'localhost,127.0.0.0/8,::1'
[2023-02-21T06:45:03Z DEBUG cargo::ops::registry] http-debug: * Uses proxy env variable https_proxy == 'http://127.0.0.1:1081/'
[2023-02-21T06:45:03Z DEBUG cargo::ops::registry] http-debug: * Found bundle for host: 0x5642948e47c0 [serially]
[2023-02-21T06:45:03Z DEBUG cargo::ops::registry] http-debug: * Server doesn't support multiplex yet, wait
[2023-02-21T06:45:03Z DEBUG cargo::ops::registry] http-debug: * No connections available.
* 190 times
---
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Uses proxy env variable no_proxy == 'localhost,127.0.0.0/8,::1'
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Uses proxy env variable https_proxy == 'http://127.0.0.1:1081/'
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Found bundle for host: 0x5642948e47c0 [can multiplex]
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * MAX_CONCURRENT_STREAMS reached, skip (100)
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Hostname 127.0.0.1 was found in DNS cache
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Transfer was pending, now try another
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: *   Trying 127.0.0.1:1081...
---
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Uses proxy env variable no_proxy == 'localhost,127.0.0.0/8,::1'
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Uses proxy env variable https_proxy == 'http://127.0.0.1:1081/'
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Found bundle for host: 0x5642948e47c0 [can multiplex]
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * MAX_CONCURRENT_STREAMS reached, skip (100)
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * No more connections allowed to host: 2
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * No connections available.
* 90 times
---
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Connected to 127.0.0.1 (127.0.0.1) port 1081 (#1)
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * allocate connect buffer
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Establish HTTP proxy tunnel to crates.io:443
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: > CONNECT crates.io:443 HTTP/1.1
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: > Host: crates.io:443
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: > User-Agent: cargo 1.67.1
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: > Proxy-Connection: Keep-Alive
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: > 
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: < HTTP/1.1 200 Connection established
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: < 
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * CONNECT phase completed
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * CONNECT tunnel established, response 200
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * ALPN: offers h2,http/1.1
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * TLSv1.3 (OUT), TLS handshake, Client hello (1):
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
---
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Uses proxy env variable no_proxy == 'localhost,127.0.0.0/8,::1'
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Uses proxy env variable https_proxy == 'http://127.0.0.1:1081/'
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Found bundle for host: 0x5642948e47c0 [can multiplex]
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * client side MAX_CONCURRENT_STREAMS reached, skip (100)
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Multiplexed connection found
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Re-using existing connection #1 with proxy 127.0.0.1
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Transfer was pending, now try another
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * [CONN-1-0] send: no filter connected
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Failed sending HTTP request
* 90 times
---
[2023-02-21T06:45:04Z DEBUG cargo::ops::registry] http-debug: * Callback aborted
* 101 times

Version

cargo 1.67.1
release: 1.67.1
host: x86_64-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.16.0 vendored)
libcurl: 7.88.1-DEV (sys:0.4.59+curl-7.86.0 system ssl:OpenSSL/3.0.8)
os: Arch Linux [64-bit]
@akiirui akiirui added the C-bug Category: bug label Feb 21, 2023
@akiirui
Copy link
Author

akiirui commented Feb 21, 2023

If set CARGO_HTTP_MULTIPLEXING=false and run cargo build, it successful to download crates.

Until there are less than 100 undownloaded crates, try Ctrl+C to stop it.

Then set CARGO_HTTP_MULTIPLEXING=true and run cargo build, it works fine when download crates number less than 100.

@ehuss
Copy link
Contributor

ehuss commented Feb 21, 2023

Can you provide the following information?

  • Which proxy are you using?
  • It looks like you may have a custom-built version of Cargo. Can you say how it was built or installed?
  • Does the same problem occur with the official distribution from https://rustup.rs/?

@akiirui
Copy link
Author

akiirui commented Feb 21, 2023

@ehuss

  • Which proxy are you using?

v2ray http inbound

  • It looks like you may have a custom-built version of Cargo. Can you say how it was built or installed?

From Arch Linux official repository extra/rust

It works fine. So is this an issue of distribution packaging? or libcurl 7.88.1 with openssl 3.0?

Thanks.

@ehuss
Copy link
Contributor

ehuss commented Feb 21, 2023

It works fine. So is this an issue of distribution packaging? or libcurl 7.88.1 with openssl 3.0?

I can't really guess what exactly it could be, but it does sound like this is an issue for Arch.

@akiirui
Copy link
Author

akiirui commented Feb 21, 2023

I can't really guess what exactly it could be, but it does sound like this is an issue for Arch.

I try to downgrade curl to 7.87, and it works fine, But when I upgrade curl to 7.88, the problem is reproduced.

Maybe I should open an issue for curl.

Thanks for your reminder.

@ehuss
Copy link
Contributor

ehuss commented Feb 21, 2023

@akiirui I've been able to reproduce this with the latest curl. I'll try doing some more digging.

@ehuss ehuss reopened this Feb 21, 2023
@akiirui
Copy link
Author

akiirui commented Feb 22, 2023

@akiirui I've been able to reproduce this with the latest curl. I'll try doing some more digging.

curl/curl@821f6e2 This commit fixes this issue.

@ehuss
Copy link
Contributor

ehuss commented Feb 22, 2023

Oh, thanks for the investigation! And glad to see it is potentially resolved. I went ahead and opened a revert in #11755. We can try to pick it up in the next update.

bors added a commit that referenced this issue Feb 22, 2023
Revert "Update curl-sys to use libcurl 7.88.1"

Reverts #11749 due to a pipewait issue, see #11746
@ehuss ehuss added A-networking Area: networking issues, curl, etc. S-blocked S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix labels Feb 22, 2023
weihanglo added a commit to weihanglo/cargo that referenced this issue Mar 19, 2023
@bors bors closed this as completed in d0a73a5 Mar 20, 2023
weihanglo added a commit to weihanglo/cargo that referenced this issue Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-networking Area: networking issues, curl, etc. C-bug Category: bug S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants