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 (nightly) just hangs there doing little https #4187

Closed
siccegge opened this issue Jun 18, 2017 · 11 comments
Closed

cargo (nightly) just hangs there doing little https #4187

siccegge opened this issue Jun 18, 2017 · 11 comments
Labels
A-git Area: anything dealing with git C-bug Category: bug

Comments

@siccegge
Copy link

I've now been waiting for something like half an hour. The machine has a fast (gbit) internet connection.

% RUST_LOG=debug /home/christoph/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo build --verbose
DEBUG:cargo::build: executing; cmd=cargo-build; args=["/home/christoph/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo", "build", "--verbose"]
DEBUG:cargo::core::workspace: find_root - trying /home/christoph/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /home/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /Cargo.toml
DEBUG:cargo::core::workspace: find_members - only me as a member
DEBUG:cargo::core::registry: load/missing  file:///home/christoph/ical-rs
DEBUG:cargo::sources::config: loading: file:///home/christoph/ical-rs
DEBUG:cargo::core::resolver: initial activation: ical v0.4.0 (file:///home/christoph/ical-rs)
DEBUG:cargo::core::registry: load/missing  registry https://github.com/rust-lang/crates.io-index
DEBUG:cargo::sources::config: loading: registry https://github.com/rust-lang/crates.io-index
    Updating registry `https://github.com/rust-lang/crates.io-index`
(gdb) bt full
#0  0x00007f1e7b2493d3 in __select_nocancel () at ../sysdeps/unix/syscall-template.S:84
No locals.
#1  0x0000559dc9066e08 in wait_for.constprop ()
No symbol table info available.
#2  0x0000559dc9066e6f in curls_read ()
No symbol table info available.
#3  0x0000559dc902e9e1 in bio_read ()
No symbol table info available.
#4  0x0000559dc913e5fb in BIO_read ()
No symbol table info available.
#5  0x0000559dc90d255c in ssl3_read_n ()
No symbol table info available.
#6  0x0000559dc90d43ef in ssl3_read_bytes ()
No symbol table info available.
#7  0x0000559dc90d092b in ssl3_read ()
No symbol table info available.
#8  0x0000559dc902ec6d in openssl_read ()
No symbol table info available.
#9  0x0000559dc9071cdc in recv_stream ()
No symbol table info available.
#10 0x0000559dc90522ee in http_stream_read ()
No symbol table info available.
#11 0x0000559dc9054c01 in git_smart.recv_cb ()
No symbol table info available.
#12 0x0000559dc9057640 in git_smart.download_pack ()
No symbol table info available.
#13 0x0000559dc903d9e2 in git_remote_download ()
No symbol table info available.
#14 0x0000559dc903e576 in git_remote_fetch ()
No symbol table info available.
#15 0x0000559dc9000713 in git2::remote::Remote::fetch::h5c49513016ded9d7 ()
No symbol table info available.
#16 0x0000559dc8eb2cc7 in cargo::sources::git::utils::fetch::_$u7b$$u7b$closure$u7d$$u7d$::h0c5eba56b5993fcb ()
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#17 0x0000559dc8eb14ee in cargo::sources::git::utils::fetch::hc184d222121d49a6 ()
No symbol table info available.
#18 0x0000559dc8ec4396 in _$LT$cargo..sources..registry..remote..RemoteRegistry$LT$$u27$cfg$GT$$u20$as$u20$cargo..sources..registry..RegistryData$GT$::update_index::h146d86650f79ca85 ()
No symbol table info available.
#19 0x0000559dc8ec9e94 in _$LT$cargo..sources..registry..RegistrySource$LT$$u27$cfg$GT$$u20$as$u20$cargo..core..source..Source$GT$::update::h0b802e936b2ab3c7 ()
No symbol table info available.
#20 0x0000559dc8de11d1 in cargo::core::registry::PackageRegistry::ensure_loaded::h16c29350919f44bd ()
No symbol table info available.
#21 0x0000559dc8de345b in _$LT$cargo..core..registry..PackageRegistry$LT$$u27$cfg$GT$$u20$as$u20$cargo..core..registry..Registry$GT$::query::ha5f5c8419423bc05 ()
No symbol table info available.
#22 0x0000559dc8d705c9 in _$LT$$RF$$u27$a$u20$mut$u20$I$u20$as$u20$core..iter..iterator..Iterator$GT$::next::h95cfc4df317c6a92 ()
No symbol table info available.
#23 0x0000559dc8dcc9d7 in cargo::core::resolver::activate::h8f7013063d87cce6 ()
No symbol table info available.
#24 0x0000559dc8dcf029 in cargo::core::resolver::activate_deps_loop::hac467bfc796b8a8f ()
No symbol table info available.
#25 0x0000559dc8dc8b25 in cargo::core::resolver::resolve::hb8171482df80b73d ()
No symbol table info available.
#26 0x0000559dc8e9d10b in cargo::ops::resolve::resolve_with_previous::h5ae4e7510a561ca4 ()
No symbol table info available.
#27 0x0000559dc8e9beca in cargo::ops::resolve::resolve_with_registry::h4125f15334dec8e0 ()
No symbol table info available.
#28 0x0000559dc8e9a843 in cargo::ops::resolve::resolve_ws_precisely::hcc688f34046c770f ()
No symbol table info available.
#29 0x0000559dc8df6280 in cargo::ops::cargo_compile::compile_ws::hfa7938087fc9ad9f ()
No symbol table info available.
#30 0x0000559dc8df5d56 in cargo::ops::cargo_compile::compile_with_exec::hb47d3f6c100981f5 ()
No symbol table info available.
#31 0x0000559dc8df5bc6 in cargo::ops::cargo_compile::compile::hd43b2af4c0cdd8eb ()
No symbol table info available.
#32 0x0000559dc8c6c46e in cargo::try_execute_builtin_command::h778c447e51525a9f ()
No symbol table info available.
#33 0x0000559dc8c61e7d in cargo::execute::h4c9abcb05bef7426 ()
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#34 0x0000559dc8c53ee2 in cargo::call_main_without_stdin::h16c43dc4def0d330 ()
No symbol table info available.
#35 0x0000559dc8c60a7e in cargo::main::hac66f0d7b377a4c2 ()
No symbol table info available.
#36 0x0000559dc9269a2b in panic_unwind::__rust_maybe_catch_panic () at /checkout/src/libpanic_unwind/lib.rs:98
No locals.
#37 0x0000559dc92631b1 in std::panicking::try<(),closure> () at /checkout/src/libstd/panicking.rs:433
No locals.
#38 std::panic::catch_unwind<closure,()> () at /checkout/src/libstd/panic.rs:361
No locals.
#39 std::rt::lang_start () at /checkout/src/libstd/rt.rs:59
No locals.
#40 0x00007f1e7b1882b1 in __libc_start_main (main=0x559dc8cd3cf0 <main>, argc=3, argv=0x7ffea7075398, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffea7075388)
    at ../csu/libc-start.c:291
        result = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {0, 582309565822031027, 94136166547620, 140731700695952, 0, 0, 6688438268297630899, 6706883579287196851}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x3, 
              0x559dc8cd3cf0 <main>}, data = {prev = 0x0, cleanup = 0x0, canceltype = 3}}}
        not_first_call = <optimized out>
#41 0x0000559dc8c480cd in _start ()
No symbol table info available.
(gdb) 
@alexcrichton
Copy link
Member

Thanks for the report! Looks like it's buried in libgit2 internals trying to fetch the remote. Could you try using strace to see what syscall it's stuck on?

@matklad
Copy link
Member

matklad commented Jun 25, 2017

Looks similar to #3564 (comment).

EDIT: yep, it's exactly the same stack trace and select!

The underlying issue was that libgit does not expose timeout control in the API, and so it may do an unbounded select on the socket. And it is possible for TCP connection to fail in such a way that the socket stays opened indefinitely.

@matklad
Copy link
Member

matklad commented Jun 25, 2017

Upstream issue about cancellation: libgit2/libgit2#3334. Anyone wants to re implement libgit2 in Rust, with cancellation tokens and such? :)

@carols10cents carols10cents added A-git Area: anything dealing with git C-bug Category: bug labels Aug 30, 2017
@marvinhagemeister
Copy link

Just hit the same issue. It's my first time playing around with rust, so I'm a bit stuck at the moment.

It just hangs with this:

$ RUST_LOG=debug cargo install racer
DEBUG:cargo::sources::config: loading: registry https://github.com/rust-lang/crates.io-index
    Updating registry `https://github.com/rust-lang/crates.io-index`
DEBUG:cargo::sources::git::utils: skipping gc as there's only 11 pack files
DEBUG:cargo::sources::git::utils: doing a fetch for https://github.com/rust-lang/crates.io-index
DEBUG:cargo::sources::git::utils: initiating fetch of refs/heads/master:refs/remotes/origin/master from https://github.com/rust-lang/crates.io-index

OS: MacOS High Sierra
cargo: cargo 0.23.0-nightly (e447ac7e9 2017-09-27)
rustc: rustc 1.22.0-nightly (02a24dbdd 2017-10-13)

@roperzh
Copy link

roperzh commented Nov 4, 2017

Same happens to me when building the guessing game in the tutorial:

§ RUST_LOG=debug cargo build
DEBUG:cargo::build: executing; cmd=cargo-build; args=["/Users/roperzh/.rustup/toolchains/stable-x86_64-apple-darwin/bin/cargo", "build"]
DEBUG:cargo::core::workspace: find_root - trying /Users/roperzh/Projects/Rust/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /Users/roperzh/Projects/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /Users/roperzh/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /Users/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /Cargo.toml
DEBUG:cargo::core::workspace: find_members - only me as a member
DEBUG:cargo::core::registry: load/missing  file:///Users/roperzh/Projects/Rust/gg
DEBUG:cargo::sources::config: loading: file:///Users/roperzh/Projects/Rust/gg
DEBUG:cargo::core::resolver: initial activation: gg v0.1.0 (file:///Users/roperzh/Projects/Rust/gg)
DEBUG:cargo::core::registry: load/missing  registry https://github.com/rust-lang/crates.io-index
DEBUG:cargo::sources::config: loading: registry https://github.com/rust-lang/crates.io-index
    Updating registry `https://github.com/rust-lang/crates.io-index`

Cargo.toml:

[package]
name = "gg"
version = "0.1.0"
authors = ["Roberto Dip <dip.jesusr@gmail.com>"]

[dependencies]
rand = "0.3.17"

OS: MacOS High Sierra

§ cargo --version
cargo 0.22.0 (3423351a5 2017-10-06)

» gg 
§ rustc --version
rustc 1.21.0 (3b72af97e 2017-10-09)

I have been trying to find a workaround in the issue tracker without success, let me know if I can help in any way :)

@alexcrichton
Copy link
Member

@roperzh if you can test out a custom build of Cargo it may be worth testing #4646 which should help give a progress indicator to what libgit2 is doing

@roperzh
Copy link

roperzh commented Nov 4, 2017

hey @alexcrichton, thanks for the help! I checked out the PR branch locally, but when I tried to compile I faced the same error 😭 . Is there any way to compile cargo without cargo?

Just for the sake of clarity, I'm following the instructions in the README:

» cargo | master
§ git fetch origin pull/4646/head:progress
remote: Counting objects: 21, done.
remote: Total 21 (delta 17), reused 17 (delta 17), pack-reused 4
Unpacking objects: 100% (21/21), done.
From https://github.com/rust-lang/cargo
 * [new ref]           refs/pull/4646/head -> progress

» cargo | master
§ git checkout progress
Switched to branch 'progress'

» cargo | progress
§ cargo build --release
    Updating registry `https://github.com/rust-lang/crates.io-index`

@alexcrichton
Copy link
Member

Ah no, unfortunately that's not too easy :(

@roperzh
Copy link

roperzh commented Nov 6, 2017

Gotcha, if I can help in any way just let me know :)

@roperzh
Copy link

roperzh commented Nov 24, 2017

Just wanted to inform that since upgrading to v1.22.1 I am able to install dependencies without issues 🎉

@alexcrichton
Copy link
Member

I'm going to close this as I think a number of intervening updates should mitigate this.

bors added a commit that referenced this issue Oct 7, 2022
fix(test): Distinguish 'testname' from escaped arguments

When working on clap v4, it appeared that `last` and `trailing_var_arg`
are mutually exclusive, so I called that out in the debug asserts in
#4187.  Unfortunately, I didn't document my research on this
as my focus was elsewhere.

When updating cargo to use clap v4 in #11159, I found `last` and
`trailing_var_arg` were used together.  I figured this was what I was
trying to catch with above and I went off of my intuitive sense of these
commands and assumed `trailing_var_arg` was intended, not knowing about
the `testname` positional that is mostly just a forward to `libtest`,
there for documentation purposes, except for a small optimization.

So it looks like we just need the `last` call and not the
`trailing_var_arg` call.

This restores us to behavior from 531ce13 which is what I originally
wrote the tests against.

It looks like #11159 was merged after the last beta branch was made, so we shouldn't
need to cherry-pick this into any other release.

For reviewing this, I made the test updates in the first commit, showing the wrong behavior.  The following commit fixes the behavior and updates the tests to expected behavior.

Fixes #11191
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 C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

6 participants