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

Unable to fetch dependencies with stable-x86_64-pc-windows-gnu #9913

Closed
AaronErhardt opened this issue Sep 15, 2021 · 8 comments
Closed

Unable to fetch dependencies with stable-x86_64-pc-windows-gnu #9913

AaronErhardt opened this issue Sep 15, 2021 · 8 comments
Labels
A-git Area: anything dealing with git O-windows OS: Windows

Comments

@AaronErhardt
Copy link

cargo update and everything else works fine if I'm using the stable-x86_64-pc-windows-msvc toolchain. However, if I'm using stable-x86_64-pc-windows-gnu, Rust suddenly can't fetch dependencies. (Because this issue depends on the toolchain, I assume it's not a problem with cargo).

Output of cargo update

    Updating crates.io index
warning: spurious network error (2 tries remaining): failed to open request: Das Handle ist ungültig.
; class=Os (2)
warning: spurious network error (1 tries remaining): failed to open request: Das Handle ist ungültig.
; class=Os (2)
error: failed to get `gtk4` as a dependency of package `relm4-components v0.1.0 (C:\Users\ERHAAAR\git\relm4\relm4-components)`

Caused by:
  failed to load source for dependency `gtk4`

Caused by:
  Unable to update registry `crates-io`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  failed to open request: Das Handle ist ungültig.
  ; class=Os (2)

"Das Handle ist ungültig" is German for "the handle is invalid".

Meta

rustc --version --verbose:

rustc 1.55.0 (c8dfcfe04 2021-09-06)
binary: rustc
commit-hash: c8dfcfe046a7680554bf4eb612bad840e7631c4b
commit-date: 2021-09-06
host: x86_64-pc-windows-msvc
release: 1.55.0
LLVM version: 12.0.1

and

rustc 1.55.0 (c8dfcfe04 2021-09-06)
binary: rustc
commit-hash: c8dfcfe046a7680554bf4eb612bad840e7631c4b
commit-date: 2021-09-06
host: x86_64-pc-windows-gnu
release: 1.55.0
LLVM version: 12.0.1
Shell log

path\to\project(main)> rustup default stable-x86_64-pc-windows-msvc
info: using existing install for 'stable-x86_64-pc-windows-msvc'
info: default toolchain set to 'stable-x86_64-pc-windows-msvc'

  stable-x86_64-pc-windows-msvc unchanged - rustc 1.55.0 (c8dfcfe04 2021-09-06)


path\to\project(main)> cargo update
    Updating crates.io index
    Updating serde_json v1.0.67 -> v1.0.68

path\to\project(main)> rustup default stable-x86_64-pc-windows-gnu
info: using existing install for 'stable-x86_64-pc-windows-gnu'
info: default toolchain set to 'stable-x86_64-pc-windows-gnu'

  stable-x86_64-pc-windows-gnu unchanged - rustc 1.55.0 (c8dfcfe04 2021-09-06)


path\to\project(main)> cargo update
    Updating crates.io index
warning: spurious network error (2 tries remaining): failed to open request: Das Handle ist ungültig.
; class=Os (2)
warning: spurious network error (1 tries remaining): failed to open request: Das Handle ist ungültig.
; class=Os (2)
error: failed to get `gtk4` as a dependency of package `relm4-components v0.1.0 (C:\Users\ERHAAAR\git\relm4\relm4-components)`

Caused by:
  failed to load source for dependency `gtk4`

Caused by:
  Unable to update registry `crates-io`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  failed to open request: Das Handle ist ungültig.
  ; class=Os (2)
path\to\project(main)>

@ehuss ehuss transferred this issue from rust-lang/rust Sep 15, 2021
@ehuss
Copy link
Contributor

ehuss commented Sep 15, 2021

Thanks for the report! I have transferred this to the cargo repository since it is almost certainly an issue with libgit2 in cargo.

Can you provide a little more information, such as the exact version of Windows you are using? Do you have a proxy configured? Is there anything else possibly unusual about your setup? Which shell are you using? (Does this happen under cmd or Powershell?)

@AaronErhardt
Copy link
Author

OS

Edition: Windows 10 Enterprise
Version: 20H2
Build: 19042.1165

Shell

I've tried cmd, PowerShell and Nu Shell. All behave indentical.

Possible unusual configurations

Most settings are managed by my company and it's likely that they use rather strict network configurations. Yet I don't have a problem with fetching https://github.com/rust-lang/crates.io-index using curl. Even git clone https://github.com/rust-lang/crates.io-index works fine.

@ehuss
Copy link
Contributor

ehuss commented Sep 15, 2021

Hm, yea, this is likely some strange interaction of the gnu build and your system. I'm at a loss on how that could happen, though, since this is C code, and looks pretty straightforward.

One thing I forgot to ask, can you also try with the latest nightly release?

As a workaround, you can try the net.git-fetch-with-cli config option, which will use the git command-line client.

@ehuss ehuss added A-git Area: anything dealing with git O-windows OS: Windows labels Sep 15, 2021
@AaronErhardt
Copy link
Author

Nightly didn't help, but with net.git-fetch-with-cli set to true cargo is able to download the index. Now I've got this error when using cargo run:

warning: spurious network error (2 tries remaining): [6] Couldn't resolve host name (getaddrinfo() thread failed to start)
warning: spurious network error (1 tries remaining): [6] Couldn't resolve host name (getaddrinfo() thread failed to start)
error: failed to download from `https://crates.io/api/v1/crates/winapi-x86_64-pc-windows-gnu/0.4.0/download`

Caused by:
  [6] Couldn't resolve host name (getaddrinfo() thread failed to start)

@AaronErhardt
Copy link
Author

It works now for some reason. Basically, I've just rebooted my PC. I don't know what's the difference though as I rebooted several times before without a solving the issue.

The only difference I can think was that I installed wget and a certificate from Zscaler to fix an issue with MSYS2. That together with net.git-fetch-with-cli seems to have solved the issue... but to be honest I'm still puzzled why this happened.

@AaronErhardt
Copy link
Author

Update: It's broken again. Again, there's nothing notable I did change on my system. I think it could be connected to another issue with curl 7.79.0 (which is the version I have installed with MSYS2): curl/curl#7730 (comment)

At least I hope the new curl version fixes this issue as well...

@AaronErhardt
Copy link
Author

The issue seems to be fixed for some reason. I think part of the problem was a ZScaler proxy in the network of my company as other package managers such as pip and npm had problems as well.

@Rock0007
Copy link

@AaronErhardt Hey, Im facing the same issue now, can u help me to fix this issue? Im struggling from 2 days like a hell.!

Screenshot 2024-01-20 180744

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git O-windows OS: Windows
Projects
None yet
Development

No branches or pull requests

3 participants