tokio-rs / loom

Concurrency permutation testing tool for Rust.
MIT License
2.14k stars 111 forks source link

`coroutine in thread XYZ has overflowed its stack` while running loom unit test #363

Open UditDey opened 1 month ago

UditDey commented 1 month ago

Hi, I'm using loom to verify a lock-free data structure that I've written (I should add this is the first time I'm using loom).

I set up 3 unit tests, each one has my structure in different configurations, and then I'm using loom to verify correctness when multiple threads are interacting with the structure. My 3rd unit test is the most intensive one. It spawns the same number of threads as the others but will involve significantly more atomic ops.

I expected the 3rd case to take a lot of time, however it fails to execute entirely:

running 1 test
test mem::page_alloc::tests::test_tree_height_3_loom ... FAILED

failures:

---- mem::page_alloc::tests::test_tree_height_3_loom stdout ----

coroutine in thread 'mem::page_alloc::tests::test_tree_height_3_loom' has overflowed its stack

failures:
    mem::page_alloc::tests::test_tree_height_3_loom

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

I can see this is a stack overflow but it specifies that a coroutine has had a stack overflow

Does loom use stackful coroutines? Or does cargo test use stackful coroutines internally? Has anyone else faced this before while running an intensive loom test?

And I'll just clarify that none of my code uses stackful coroutines. In fact loom is its only dependency so this is definitely not originating in my code. Google'ing resulted in nothing and this is the first time I've seen a stack overflow error that mentions a coroutine, so I have no clue where its originating

mox692 commented 1 month ago

Did you build the test with debug build? If so, could you also try release build and check if the problem has been resolved?

UditDey commented 1 month ago

I only ran the tests in release mode, I'll give it a shot in debug mode just to try