Skip to content

Commit

Permalink
rt: Set the stack depth limit to 1GB. Abort on error.
Browse files Browse the repository at this point in the history
People hit the recursion depth limit too often, it's not possible
to unwind reliably from out-of-stack.

Issues rust-lang#3555, rust-lang#3695
  • Loading branch information
brson committed Apr 26, 2013
1 parent 64412ec commit 149047e
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 86 deletions.
2 changes: 1 addition & 1 deletion src/rt/rust_env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ get_max_stk_size() {
return strtol(maxsz, NULL, 0);
}
else {
return 1024*1024*8;
return 1024*1024*1024;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/rt/rust_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,11 +530,11 @@ rust_task::new_stack(size_t requested_sz) {
// arbitrarily selected as 2x the maximum stack size.
if (!unwinding && used_stack > max_stack) {
LOG_ERR(this, task, "task %" PRIxPTR " ran out of stack", this);
fail();
abort();
} else if (unwinding && used_stack > max_stack * 2) {
LOG_ERR(this, task,
"task %" PRIxPTR " ran out of stack during unwinding", this);
fail();
abort();
}

size_t sz = rust_stk_sz + RED_ZONE_SIZE;
Expand Down
19 changes: 0 additions & 19 deletions src/test/run-fail/issue-2144.rs

This file was deleted.

25 changes: 0 additions & 25 deletions src/test/run-fail/out-of-stack-managed-box.rs

This file was deleted.

21 changes: 0 additions & 21 deletions src/test/run-fail/out-of-stack-owned-box.rs

This file was deleted.

18 changes: 0 additions & 18 deletions src/test/run-fail/too-much-recursion.rs

This file was deleted.

1 comment on commit 149047e

@thestinger
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

Please sign in to comment.