Rust 1.59 and 1.61 nightly breaks Rust 1.58 code due to stackoverflow with tracing

I post this on the Rust forum and not on the Tokio github issue tracker because this seems related to the Rust version rather than the Tokio runtime.

I have tests which are failing on Rust 1.59 and Rust 1.61 nightly which are working perfectly fine in Rust 1.58. After upgrading to Rust 1.59, I saw this error:

thread 'tokio-runtime-worker' has overflowed its stack
fatal runtime error: stack overflow

Again, this happens only on Rust 1.59>. I triple checked it by switching back and forth with rustup default 1.5x.0. This is why it panics:

and the relevant code:
(new post because I am a new user and I can only post 1 media item... see the reply below)

The code is from a lib I wrote a while ago, here is a link with example code: Catalytic/child.rs at d197bbf3f3b7cf3f5439f8c7c7d063937af1c4e9 · Jasperav/Catalytic · GitHub.

But the lib is unrelated. When I comment out that line of code which calls the select_unique fn, it fails on a different tracing::debug call within my crate. So it looks like the problem is in the macro call.

Any ideas what I can try? This looks really like a Rust 1.59> bug to me.

I have NOT been able to reproduce this problem within a unit test. All the tests of my crate are running green locally and on CI. It only fails when a client (some mobile application) runs some tests directly agains the server.

Second media item:

Maybe try playing with the runtime::Builder::thread_stack_size setting to see whether you can find the threshold that makes it fail or not fail. Then you can compare thresholds between the different Rust version. If the stack size needed only increased slightly, and just happened to land close to the limit beforehand anyways, this might not be a significant regression at all. And if the stack usage grew very significantly, this would give some additional information about how bad of a change happened.

6 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.