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

"fatal, 'on_rust_stack()' failed" with recursive resource #2061

Closed
jruderman opened this issue Mar 28, 2012 · 10 comments
Closed

"fatal, 'on_rust_stack()' failed" with recursive resource #2061

jruderman opened this issue Mar 28, 2012 · 10 comments
Labels
A-codegen Area: Code generation A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. P-low Low priority

Comments

@jruderman
Copy link
Contributor

resource r(b: int) { r(b); }
fn main() { r(0); }

Hits a fatal assertion rather than simply failing:

rust: task 7fce71800000 ran out of stack
rust: fatal, 'on_rust_stack()' failed, ../src/rt/rust_task.cpp:570 
@ghost ghost assigned brson Mar 28, 2012
@brson
Copy link
Contributor

brson commented Mar 28, 2012

I don't see that assert fail, instead this:

rust: task 6598840 ran out of stack
terminate called after throwing an instance of 'rust_task*'
==14512== 136 bytes in 1 blocks are possibly lost in loss record 10 of 23
==14512==    at 0x4C28FAC: malloc (vg_replace_malloc.c:236)
==14512==    by 0x633E232: __cxa_allocate_exception (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.14)
==14512==    by 0x5472688: rust_task::fail() (rust_task.cpp:256)
==14512==    by 0x5472CAC: rust_task::new_stack(unsigned long) (rust_task.cpp:504)
==14512==    by 0x5485CB8: ??? (in /home/banderson/Dev/rust2/build/x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so)
==14512== 

Which is also bad

@brson
Copy link
Contributor

brson commented Mar 28, 2012

This may be a symptom of the general brokenness of failing destructors (#910)

catamorphism added a commit that referenced this issue Nov 1, 2012
@catamorphism
Copy link
Contributor

Translating this test to use structs, I correctly got the "ran out of stack" error. There are no errors with valgrind. Added the test, closing this.

@brson brson reopened this Nov 2, 2012
@brson
Copy link
Contributor

brson commented Nov 2, 2012

@catamorphism
Copy link
Contributor

The test fails on the Mac bot because the test executable is returning an exit code of 1 instead of 101. @brson advised that the bot behavior is likely because the unwinder doesn't know what to do and calls abort() (whereas unwinding seems to work correctly because of my machine). He thought maybe the difference was due to optimization, so I'll try recompiling on my machine with optimization enabled.

@catamorphism
Copy link
Contributor

I confirmed that the test fails with optimization enabled, but passes with optimization disabled. In the optimized version, in rust_task::task_start_wrapper, the catch block appears never to execute, which means the cleanup code doesn't run and the code that would return the correct exit code isn't reached. In the unoptimized version, the catch block does execute. That's about as much as I could figure out.

@brson
Copy link
Contributor

brson commented Nov 2, 2012

As part of #3695 I want to make running out of stack a fatal runtime error, instead of a recoverable task failure, so hopefully that will make this issue moot.

@pnkfelix
Copy link
Member

visited for triage. I think at this point this should probably be treated as a duplicate of #3695, in the sense that whatever resolution we end up with for that bug should also dictate the resolution for this bug.

@catamorphism
Copy link
Contributor

#910 is milestoned for 1.0, so this one is low priority on its own.

@alexcrichton
Copy link
Member

Closing in favor of #11011, I'm not entirely certain what a resource is, but we don't have stack switching any more, we do have prints on stack overflow, and #11011 should cover using fail!() instead of abort

steveklabnik added a commit to steveklabnik/rust that referenced this issue Jun 12, 2015
This test was added on Nov 1, 2012:
rust-lang@0069bd2#diff-b516ff69faf8886c48e6f5e833c2548c

and then ignored on the same day:
rust-lang@a90020f#diff-b516ff69faf8886c48e6f5e833c2548c

and never unignored again.
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Kobzol pushed a commit to Kobzol/rust that referenced this issue Dec 30, 2024
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. P-low Low priority
Projects
None yet
Development

No branches or pull requests

5 participants