-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Runtime stack overflow that does not make any sense #58164
Comments
Also it looks not like it would compile. Can you try to provide a MCVE? |
@hellow554 I will try. But as I said, I was unable to replicate this issue from MCVE. Is there any way to diagnose this problem? Can I print the overflowed stack? |
You could try to use gdb to debug the problem. Maybe |
I have run this test program individually and it have a core dump. But gdb does not show anything useful. Anything I can try?
|
@hellow554 I just realized I have right tools for debugging. But the debug produced another segment fault.
Maybe this is related? #43102 |
If you're declaring or returning large local variables, they might overflow the stack. The default stack size is 8 MB or so on Linux and 2 MB (IIRC) on Windows. Your array might be larger than that. Note that I haven't looked at your original code. |
@lnicola Yes, there are functions returning large variables. This can explain the problem. Guess I should allocate pages on heaps instead. Thanks. |
I am developing a B+ plus tree which its page size is controlled by generic typing arrays.
Before I put it on large scale, I did tried to write tests and it works. When I tried to set the page size as large as
240000
. I got stack overflow error. I have nailed the problem to one function and write a test for it but the behaviour looks strange to me. The test code, which is:It have a
debug
macro which will printtesting
before thenew
function to be invoked. The test case actually overflows stack without printingtesting
. If we replace thenew
function withpanic!()
, it will pass the test withtesting
been printed. The most interesting part is, if we clear thenew
function and make an explicit panic, it still overflow stack.If we decrease
LARGE_PAGE_SIZE
to24000
, the test case will panic without overflow stack, which is exactly what I expected. This problem does not seems like my problem for thenew
function have not been invoked during the stack overflow.Because I have no clue about how this happened, I was unable to replicate this issue on playground. As far as my attempt, this works without stack overflow
Feel free to checkout and play around by
cargo test --package neb --lib index::btree::test::large_page -- --nocapture
Error
Rust Version
rustc 1.34.0-nightly (f6fac4225 2019-02-03)
The text was updated successfully, but these errors were encountered: