Thread 'tokio-runtime-worker' has overflowed its stack

Hi ,

I am getting thread 'tokio-runtime-worker' has overflowed its stack
fatal runtime error: stack overflow. I am not sure which code path is creating this. Any idea of how to identify code path?

Tried with RUST_BACKTRACE=full but no luck.

Well one potential cause would of course be infinite recursion, but barring that, it sometimes happen if you try to use large stack arrays in code like this:

let mut buf = [0; 1024];
loop {
    let len = stream.read(&mut buf).await?;
    ...
}

if you have such loops, try using a Vec<u8> or Box<[u8]> instead of the stack array.

1 Like

Thanks for reply. I am not using stacks in loops. Same code was working . Just compiled again and new binary stopped working. Still trying to figure out which code piece is actually causing this.

Looks like issue was from third party which recently changes their impl using self in fmt::Display.

For ref: https://github.com/pimeys/a2/issues/46

Closing this thread.

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