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
Run cargo with a large stack #1908
Conversation
There have been a number of reports of Cargo triggering a stack overflow in the algorithm implemented in `cargo::core::resolve`, and although many attempts have been made to reduce the stack space of the two relevant recursive functions it seems likely that this will not always be enough. For now, before moving the recursion to the heap manually, spawn the main thread with a large stack (e.g. mirror what the compiler does) to ensure that the same scenarios happen across platforms at least. Currently on my machine I get a 2MB stack on Linux and a 512K stack on OSX, so bumping this up to 8MB should be more than enough for the recursion in this algorithm. I also hope that with nonzeroing drop a few of the recursive calls will be able to become tail recursive, which should also help with stack space! Closes rust-lang#1897
r? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
I built Cargo on a mac with this PR and managed to build Servo with it. Thanks Alex! |
Travis & appveyor both failed? r=me if they're spurious. |
@bors: r=huonw Yeah those were fixed in the "update deps" PR |
📌 Commit 0139707 has been approved by |
There have been a number of reports of Cargo triggering a stack overflow in the algorithm implemented in `cargo::core::resolve`, and although many attempts have been made to reduce the stack space of the two relevant recursive functions it seems likely that this will not always be enough. For now, before moving the recursion to the heap manually, spawn the main thread with a large stack (e.g. mirror what the compiler does) to ensure that the same scenarios happen across platforms at least. Currently on my machine I get a 2MB stack on Linux and a 512K stack on OSX, so bumping this up to 8MB should be more than enough for the recursion in this algorithm. I also hope that with nonzeroing drop a few of the recursive calls will be able to become tail recursive, which should also help with stack space! Closes #1897
☀️ Test successful - cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-gnu-64, cargo-win-msvc-32, cargo-win-msvc-64 |
There have been a number of reports of Cargo triggering a stack overflow in the
algorithm implemented in
cargo::core::resolve
, and although many attempts havebeen made to reduce the stack space of the two relevant recursive functions it
seems likely that this will not always be enough. For now, before moving the
recursion to the heap manually, spawn the main thread with a large stack (e.g.
mirror what the compiler does) to ensure that the same scenarios happen across
platforms at least.
Currently on my machine I get a 2MB stack on Linux and a 512K stack on OSX, so
bumping this up to 8MB should be more than enough for the recursion in this
algorithm. I also hope that with nonzeroing drop a few of the recursive calls
will be able to become tail recursive, which should also help with stack space!
Closes #1897