Stack overflow in tests on beta/nightly in debug mode?

One of the tests in rust-html2text now fails with a stack overflow on beta/nightly in debug mode, but passes on the current stable (1.39). It also passes on beta/nightly with --release, so I'm not too worried, but I'd quite like to understand it. (Travis report, but verified locally: https://travis-ci.org/jugglerchris/rust-html2text/builds/620857389)

The test (test_deeply_nested_table) simply generates a very deeply nested HTML fragment to test for unbounded recursion. In that sense it's succeeded in finding some. :slight_smile: But it has been passing in the past. It's not just a marginal failure - I tried doubling the nesting depth without it failing on stable.

So for some reason since 1.39 there's some change - I guess either one or more stack frames are now significantly larger in non-release mode, or the thread stack size is significantly smaller. I'm curious enough to look into it in a bit more detail when I get another chunk of time, but I'd be interested if anyone knows of a change in rustc which could have changed this behaviour.

Thanks,

Chris

I tried looking for the change, but couldn't find it. But generally tests are run in a new thread instead of in the main thread, and new threads are 2 MiB by default while the main thread has a default size of 8 MiB.

You can set the environment variable RUST_MIN_STACK to e.g. 8388608 which is the number of bytes in 8 MiB.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.