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

Windows: v1.3.1 stopped working with VPN on #1417

Open
eugenesvk opened this issue Sep 27, 2023 · 26 comments · Fixed by #1436
Open

Windows: v1.3.1 stopped working with VPN on #1417

eugenesvk opened this issue Sep 27, 2023 · 26 comments · Fixed by #1436
Labels
Report: bug Something isn't working

Comments

@eugenesvk
Copy link

After updating cargo binstall to v1.3.1, I am unable to use it on Windows 10 behind a VPN due to some DNS issues

├─▶ could not GET https://index.crates.io/config.json: error sending request for url (https://index.crates.io/config.json): error

(maybe related to this fix in v1.3.1 "Fixed slow dns resolution inside VMware/VirtualBox(#1339 #1364 #1365)"?)

The full error message for "cargo binstall cargo-semver-checks -v"
 WARN Failed to retrieve token from `gh auth token` err=Error { kind: NotFound, message: "program not found" }
 INFO resolve: Resolving package: 'cargo-semver-checks'
DEBUG resolve:fetch_crate_matched{self=SparseRegistry { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None,
host: Some(Domain("index.crates.io")), port: None, path: "/", query: None, fragment: None }, dl_template: OnceCell { value: None } } client=Client(Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, service: DelayRequest { inner: Mutex { data: Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, num_request: 1, per: 10ms, until: Instant { t: 3231.4442715s }, state: Ready { rem: 1 } }, poisoned: false, .. }, hosts_to_delay: Mutex { data: {}, poisoned: false, .. } } }) crate_name="cargo-semver-checks" version_req=VersionReq { comparators: [] }}: Downloading from: 'https://index.crates.io/config.json'
DEBUG get_target_from_rustc()=Some("x86_64-pc-windows-msvc")
 INFO resolve:fetch_crate_matched{self=SparseRegistry { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None,
host: Some(Domain("index.crates.io")), port: None, path: "/", query: None, fragment: None }, dl_template: OnceCell { value: None } } client=Client(Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, service: DelayRequest { inner: Mutex { data: Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, num_request: 1, per: 10ms, until: Instant { t: 3231.4442715s }, state: Ready { rem: 1 } }, poisoned: false, .. }, hosts_to_delay: Mutex { data: {}, poisoned: false, .. } } }) crate_name="cargo-semver-checks" version_req=VersionReq { comparators: [] }}:do_send_request{self=Client(Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, service: DelayRequest { inner: Mutex { data: Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, num_request: 1, per: 10ms, until: Instant { t: 3231.4442715s }, state: Ready { rem: 1 } }, poisoned: false, .. }, hosts_to_delay: Mutex { data: {}, poisoned: false, .. } } }) request=Request { method: GET, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host:
Some(Domain("index.crates.io")), port: None, path: "/config.json", query: None, fragment: None }, headers: {} } url=Url { scheme: "https",
cannot_be_a_base: false, username: "", password: None, host: Some(Domain("index.crates.io")), port: None, path: "/config.json", query: None, fragment: None }}: Received timeout error from reqwest. Delay future request by 200ms
DEBUG resolve:fetch_crate_matched{self=SparseRegistry { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None,
host: Some(Domain("index.crates.io")), port: None, path: "/", query: None, fragment: None }, dl_template: OnceCell { value: None } } client=Client(Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, service: DelayRequest { inner: Mutex { data: Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, num_request: 1, per: 10ms, until: Instant { t: 3231.4442715s }, state: Ready { rem: 1 } }, poisoned: false, .. }, hosts_to_delay: Mutex { data: {}, poisoned: false, .. } } }) crate_name="cargo-semver-checks" version_req=VersionReq { comparators: [] }}:do_send_request{self=Client(Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, service: DelayRequest { inner: Mutex { data: Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, num_request: 1, per: 10ms, until: Instant { t: 3231.4442715s }, state: Limited }, poisoned: false, .. }, hosts_to_delay: Mutex { data: {"index.crates.io": Instant { t: 3231.6720956s }}, poisoned: false, .. } } }) request=Request { method: GET, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("index.crates.io")), port: None, path: "/config.json", query: None, fragment: None }, headers: {} } url=Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("index.crates.io")), port: None, path: "/config.json", query: None, fragment: None }}: server-side rate limit exceeded; sleeping.
 INFO resolve:fetch_crate_matched{self=SparseRegistry { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None,
host: Some(Domain("index.crates.io")), port: None, path: "/", query: None, fragment: None }, dl_template: OnceCell { value: None } } client=Client(Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, service: DelayRequest { inner: Mutex { data: Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, num_request: 1, per: 10ms, until: Instant { t: 3231.4442715s }, state: Ready { rem: 1 } }, poisoned: false, .. }, hosts_to_delay: Mutex { data: {}, poisoned: false, .. } } }) crate_name="cargo-semver-checks" version_req=VersionReq { comparators: [] }}:do_send_request{self=Client(Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, service: DelayRequest { inner: Mutex { data: Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, num_request: 1, per: 10ms, until: Instant { t: 3231.4442715s }, state: Limited }, poisoned: false, .. }, hosts_to_delay: Mutex { data: {"index.crates.io": Instant { t: 3231.6720956s }}, poisoned: false, .. } } }) request=Request { method: GET, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("index.crates.io")), port: None, path: "/config.json", query: None, fragment: None }, headers: {} } url=Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("index.crates.io")), port: None, path: "/config.json", query: None, fragment: None }}: Received timeout error from reqwest. Delay future request by 200ms
DEBUG resolve:fetch_crate_matched{self=SparseRegistry { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None,
host: Some(Domain("index.crates.io")), port: None, path: "/", query: None, fragment: None }, dl_template: OnceCell { value: None } } client=Client(Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, service: DelayRequest { inner: Mutex { data: Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, num_request: 1, per: 10ms, until: Instant { t: 3231.4442715s }, state: Ready { rem: 1 } }, poisoned: false, .. }, hosts_to_delay: Mutex { data: {}, poisoned: false, .. } } }) crate_name="cargo-semver-checks" version_req=VersionReq { comparators: [] }}:do_send_request{self=Client(Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, service: DelayRequest { inner: Mutex { data: Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, num_request: 1, per: 12ms, until: Instant { t: 3231.8954146s }, state: Limited }, poisoned: false, .. }, hosts_to_delay: Mutex { data: {"index.crates.io": Instant { t: 3232.1161502s }}, poisoned: false, .. } } }) request=Request { method: GET, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("index.crates.io")), port: None, path: "/config.json", query: None, fragment: None }, headers: {} } url=Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("index.crates.io")), port: None, path: "/config.json", query: None, fragment: None }}: server-side rate limit exceeded; sleeping.
 INFO resolve:fetch_crate_matched{self=SparseRegistry { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None,
host: Some(Domain("index.crates.io")), port: None, path: "/", query: None, fragment: None }, dl_template: OnceCell { value: None } } client=Client(Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, service: DelayRequest { inner: Mutex { data: Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, num_request: 1, per: 10ms, until: Instant { t: 3231.4442715s }, state: Ready { rem: 1 } }, poisoned: false, .. }, hosts_to_delay: Mutex { data: {}, poisoned: false, .. } } }) crate_name="cargo-semver-checks" version_req=VersionReq { comparators: [] }}:do_send_request{self=Client(Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, service: DelayRequest { inner: Mutex { data: Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.4.1"} }, num_request: 1, per: 12ms, until: Instant { t: 3231.8954146s }, state: Limited }, poisoned: false, .. }, hosts_to_delay: Mutex { data: {"index.crates.io": Instant { t: 3232.1161502s }}, poisoned: false, .. } } }) request=Request { method: GET, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("index.crates.io")), port: None, path: "/config.json", query: None, fragment: None }, headers: {} } url=Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("index.crates.io")), port: None, path: "/config.json", query: None, fragment: None }}: Received timeout error from reqwest. Delay future request by 200ms
DEBUG run time: 928.2901ms
ERROR Fatal error:
  × For crate cargo-semver-checks: could not GET https://index.crates.io/config.json: error sending request for url (https://
  │ index.crates.io/config.json): error trying to connect: dns error: Default Interface not found
  ├─▶ could not GET https://index.crates.io/config.json: error sending request for url (https://index.crates.io/config.json): error
  │   trying to connect: dns error: Default Interface not found
  ├─▶ error sending request for url (https://index.crates.io/config.json): error trying to connect: dns error: Default Interface not
  │   found
  ├─▶ error trying to connect: dns error: Default Interface not found
  ├─▶ dns error: Default Interface not found
  ╰─▶ Default Interface not found
@NobodyXu
Copy link
Member

cc @Sculas @GNQG

@passcod
Copy link
Member

passcod commented Sep 27, 2023

Can you upgrade to 1.4.1 to see if that helps any by any random chance?

@Sculas
Copy link
Contributor

Sculas commented Sep 27, 2023

Which VPN are you using? If it's one where it uses a custom network adapter instead of intercepting the default one, it might explain why it's choosing Ethernet/WiFi over the VPN network adapter. Seems like we're missing debug logs in the resolver, that's definitely something that needs to be added, because it'll tell us what's happening. I'm currently unable to do this myself, so if someone wants to do this: log the available adapter names, possible candidates and the adapter which is selected. If not, I'll look into PR'ing that myself soon so we can start figuring out the issue.

@eugenesvk
Copy link
Author

Can you upgrade to 1.4.1 to see if that helps any by any random chance?

that's the one I've started with to check the new great package signatures feature, it's also broken

@NobodyXu
Copy link
Member

NobodyXu commented Oct 2, 2023

I think we will have to add more logging to discover the problem.
Would like to do this myself but is busy right now.

@eugenesvk
Copy link
Author

eugenesvk commented Oct 2, 2023

Which VPN are you using?

I'm using OpenVPN, don't know whether that uses a custom network adapter (is it this TUN thing?)

(the vpn provider is PIA, tested their native app as well, same result, also not sure whether/what kind of adapters they are using)

@Sculas
Copy link
Contributor

Sculas commented Oct 2, 2023

@eugenesvk You can check which network adapters exist in the Control Panel. You can find it manually, or press Win + R and run this command to open the Network Connections window immediately: explorer ::{7007ACC7-3202-11D1-AAD2-00805FC1270E}.
That should open a tab listing all of the available network adapters. If possible, can you send a screenshot of your network adapters while you're connected to your VPN? (if needed, you can censor anything you don't want to share)

@eugenesvk
Copy link
Author

NetworkAct

this is the active list while connecting to the OpenVPN client, so it does indeed use a network adapter (though it's TAP, not TUN :))

and the inactive ones (don't think these are relevant, but not sure

Network2

@Sculas
Copy link
Contributor

Sculas commented Oct 4, 2023

Which VPN are you using? If it's one where it uses a custom network adapter instead of intercepting the default one, it might explain why it's choosing Ethernet/WiFi over the VPN network adapter.

Well... it looks like I misread the issue initially, sorry about that. I mistakenly thought the VPN was blocking the primary Ethernet/LAN adapter (aka killswitch in most VPNs), but looking better at the verbose logs, it says Default Interface not found (which changes the story).

Anyway, I've implemented verbose logging in my dns-adapter-fix branch, which you can install using this command:

cargo install cargo-binstall --locked --force --git https://github.com/Sculas/cargo-binstall.git --branch dns-adapter-fix

Then, run this command (using cargo-nextest as an example here), again while you're connected to your VPN:

cargo binstall cargo-nextest -y --log-level trace --json-output > out.txt

Open the out.txt file and look for Using custom DNS resolver configuration, it should be around line 10. Copy the text until it says Resolver configuration complete, censor/remove anything you'd rather not share (e.g. DNS servers), and send it here (using a <details> tag if very long).

Lastly, run ipconfig and check if the IPv4/IPv6 addresses are the same as the local IP address mentioned in out.txt above. Are they different or not? Does the aforementioned local IP address correspond to any of the adapters shown in ipconfig?

Unfortunately, I don't have a VPN client at hand that uses OpenVPN, so I have to ask a lot of questions, but I'm sure we'll figure it out :)

@eugenesvk
Copy link
Author

Thanks, will build&check your branch later

Unfortunately, I don't have a VPN client at hand that uses OpenVPN,

Maybe try with a native client as that one also bugs for me, I've just tested with OpenVPN as a double-check

@Sculas
Copy link
Contributor

Sculas commented Oct 4, 2023

Maybe try with a native client as that one also bugs for me, I've just tested with OpenVPN as a double-check

I only have AdGuard VPN which intercepts the primary Ethernet adapter instead of having its own network adapter, hence I'm unable to reproduce this myself.

@eugenesvk
Copy link
Author

eugenesvk commented Oct 4, 2023

Hm, your version works fine (checked again the downloaded 1.4.2, and that one still fails).

Can the fact that it's buit locally vs. downloaded from the CI explain it (the locally built version is also much smaller, 8.5m vs 13.5m)?

Not sure whether the logs are relevant without an error, but FYI https://gist.github.com/eugenesvk/4a315b6ab8855bac2749a14deef07f9e

The IP address matches the one from OpenVPN TAP-Windows6 in ipconfig

@NobodyXu
Copy link
Member

NobodyXu commented Oct 4, 2023

dns-adapter-fix contains latest update on main: We upgrade to trust-dns-resolver v0.23 and update transitive dependencies, which could be the reason why you cannot reproduce it.

@eugenesvk Can you try installing the latest version from main via cargo install cargo-binstall --git https://github.com/cargo-bins/cargo-binstall?

@eugenesvk
Copy link
Author

the main repo still fails, so I guess the refactoring done to add logging also fixed the issue?

@Sculas
Copy link
Contributor

Sculas commented Oct 4, 2023

That could very well be correct. Since I wanted to log all candidates (and not just the one that was found first), I rewrote the default_net::get_default_interface() function but found I could skip the for-loop done by default_net because I didn't need the default_net interface, but the one from ipconfig. I guess that accidentally fixed it? (could be a bug in default_net::interfaces()?)

@NobodyXu I didn't spend too much effort in that branch since I just wanted to know if it works or not. Is it okay if I PR the branch and resolve any of the requested changes you may have?

@NobodyXu
Copy link
Member

NobodyXu commented Oct 4, 2023

Yes @Sculas

@Sculas
Copy link
Contributor

Sculas commented Oct 4, 2023

@NobodyXu Done! #1436

github-merge-queue bot pushed a commit that referenced this issue Oct 5, 2023
* feat: logging for dns resolver

* refactor: fix clippy warnings

* refactor: actually fix clippy warnings

* refactor: apply requested changes
@NobodyXu
Copy link
Member

NobodyXu commented Oct 5, 2023

I would probably release a new version this weekend

@ilyagr

This comment was marked as duplicate.

@Sculas

This comment was marked as duplicate.

@ilyagr

This comment was marked as duplicate.

@Sculas

This comment was marked as duplicate.

@Sculas

This comment was marked as duplicate.

@NobodyXu

This comment was marked as duplicate.

@NobodyXu

This comment was marked as duplicate.

@Sculas

This comment was marked as duplicate.

@passcod passcod changed the title v1.3.1 stopped working with VPN on Windows: v1.3.1 stopped working with VPN on Oct 6, 2023
@passcod passcod added the Report: bug Something isn't working label Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Report: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants