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

stack overflow when compiling jemallocator #5708

Closed
gnzlbg opened this issue Jul 11, 2018 · 5 comments · Fixed by #5711
Closed

stack overflow when compiling jemallocator #5708

gnzlbg opened this issue Jul 11, 2018 · 5 comments · Fixed by #5711

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Jul 11, 2018

See https://github.com/alexcrichton/jemallocator/issues/61

It might be a cargo issue, since the crate doesn't even compile.

git clone git@github.com:alexcrichton/jemallocator.git
# We are working around this issue on master, the following commit
# that used to work reproduces the issue:
git checkout de8bcc693242e7ad3deb2b4a083e6b2cb107379e
cd jemallocator
cargo test -vv  -p jemalloc-sys

fails with:

thread 'main' has overflowed its stack
fatal runtime error: stack overflow

Running lldb reports:

    frame #30674: 0x00000001003b3406 cargo`cargo::core::compiler::context::compilation_files::metadata_of::h1377c51c44490a0e (.llvm.10155370706564831419) + 1046
    frame #30675: 0x00000001002c1a73 cargo`_$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$alloc..vec..SpecExtend$LT$T$C$$u20$I$GT$$GT$::from_iter::h8d627d05abe98e62 + 163
    frame #30676: 0x00000001003b3406 cargo`cargo::core::compiler::context::compilation_files::metadata_of::h1377c51c44490a0e (.llvm.10155370706564831419) + 1046
    frame #30677: 0x00000001002c1a73 cargo`_$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$alloc..vec..SpecExtend$LT$T$C$$u20$I$GT$$GT$::from_iter::h8d627d05abe98e62 + 163
    frame #30678: 0x00000001003b3406 cargo`cargo::core::compiler::context::compilation_files::metadata_of::h1377c51c44490a0e (.llvm.10155370706564831419) + 1046
    frame #30679: 0x00000001002c1a73 cargo`_$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$alloc..vec..SpecExtend$LT$T$C$$u20$I$GT$$GT$::from_iter::h8d627d05abe98e62 + 163
    frame #30680: 0x00000001003b3406 cargo`cargo::core::compiler::context::compilation_files::metadata_of::h1377c51c44490a0e (.llvm.10155370706564831419) + 1046
    frame #30681: 0x00000001002c1a73 cargo`_$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$alloc..vec..SpecExtend$LT$T$C$$u20$I$GT$$GT$::from_iter::h8d627d05abe98e62 + 163
    frame #30682: 0x00000001003b3406 cargo`cargo::core::compiler::context::compilation_files::metadata_of::h1377c51c44490a0e (.llvm.10155370706564831419) + 1046
    frame #30683: 0x00000001003b071c cargo`cargo::core::compiler::context::compilation_files::CompilationFiles::new::h66fee72ceee36cd6 + 108
    frame #30684: 0x00000001001fc5de cargo`cargo::core::compiler::context::Context::prepare_units::ha547edde6c67aa45 + 750
    frame #30685: 0x00000001001fa46e cargo`cargo::core::compiler::context::Context::compile::h12022378937f4dce + 238
    frame #30686: 0x00000001001250c1 cargo`cargo::ops::cargo_compile::compile_ws::h729cd70799cd6467 + 11105
    frame #30687: 0x00000001001220db cargo`cargo::ops::cargo_compile::compile_with_exec::h9eb79a516b8ba936 + 395
    frame #30688: 0x00000001001a14dc cargo`cargo::ops::cargo_test::compile_tests::hf96f120cf7301ba3 + 92
    frame #30689: 0x00000001001a098c cargo`cargo::ops::cargo_test::run_tests::h32ed0913c2b1837e + 44
    frame #30690: 0x000000010004fe9b cargo`cargo::commands::test::exec::h5212fd998f544836 + 1147
    frame #30691: 0x0000000100012f59 cargo`cargo::cli::main::h5a4c5fdf41da489e + 4345
    frame #30692: 0x000000010000ded6 cargo`cargo::main::hd16f3801c6514bd6 + 134
    frame #30693: 0x0000000100034ac6 cargo`std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h132926336c109f4c + 6
    frame #30694: 0x00000001007323e8 cargo`std::panicking::try::do_call::hef9dda5d08757d6c (.llvm.7045045766936433836) + 24
    frame #30695: 0x000000010073ec1f cargo`__rust_maybe_catch_panic + 31
    frame #30696: 0x0000000100721832 cargo`std::rt::lang_start_internal::hccd3760e054b55b8 + 242
    frame #30697: 0x000000010001029c cargo`main + 44
    frame #30698: 0x0000000100001434 cargo`start + 52
@alexcrichton
Copy link
Member

@ehuss a bisection points to #5651 with a minimization of:

[package]
name = "foo"
version = "0.1.0"
authors = []

[lib]
test = false

@alexcrichton
Copy link
Member

Er actual minimization:

[package]
name = "jemalloc-sys"
version = "0.1.7"
authors = []
links = 'foo' # important
build = 'build.rs'

[lib]
test = false
path = 'lib.rs'

You shouldn't even need any other files on the filesystem, cargo +nightly test is enough to stack overflow

@alexcrichton
Copy link
Member

Hm ok I think this was just a regression uncovered by that PR (although not sure why), this looks like it may be a longstanding bug, still investigating.

@alexcrichton
Copy link
Member

Er wait no, it's directly related to these changes, I accidentally thought that'd had been there before.

@alexcrichton
Copy link
Member

A fix should be in #5711

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Jul 13, 2018
Some logic which was tweaked around the dependencies of build script targets was
tweaked slightly in a way that causes cargo to stack overflow by accientally
adding a dependency loop. This commit implements one of the strategies discussed
in rust-lang#5711 to fix this situation.

The problem here is that when calculating the deps of a build script we need the
build scripts of *other* packages, but the exact profile is somewhat difficult
to guess at the moment we're generating our build script unit. To solve this the
dependencies towards other build scripts' executions is added in a different
pass after all other units have been assembled. At this point we should know for
sure that all build script executions are in the dependency graph, and we just
need to add a few more edges.

Closes rust-lang#5708
bors added a commit that referenced this issue Jul 13, 2018
Partially revert dep changes in #5651

Some logic which was tweaked around the dependencies of build script targets was
tweaked slightly in a way that causes cargo to stack overflow by accientally
adding a dependency loop. This commit implements one of the strategies discussed
in #5711 to fix this situation.

The problem here is that when calculating the deps of a build script we need the
build scripts of *other* packages, but the exact profile is somewhat difficult
to guess at the moment we're generating our build script unit. To solve this the
dependencies towards other build scripts' executions is added in a different
pass after all other units have been assembled. At this point we should know for
sure that all build script executions are in the dependency graph, and we just
need to add a few more edges.

Closes #5708
alexcrichton added a commit to alexcrichton/cargo that referenced this issue Jul 13, 2018
Some logic which was tweaked around the dependencies of build script targets was
tweaked slightly in a way that causes cargo to stack overflow by accientally
adding a dependency loop. This commit implements one of the strategies discussed
in rust-lang#5711 to fix this situation.

The problem here is that when calculating the deps of a build script we need the
build scripts of *other* packages, but the exact profile is somewhat difficult
to guess at the moment we're generating our build script unit. To solve this the
dependencies towards other build scripts' executions is added in a different
pass after all other units have been assembled. At this point we should know for
sure that all build script executions are in the dependency graph, and we just
need to add a few more edges.

Closes rust-lang#5708
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