|
|
Subscribe / Log in / New account

Losing Data? Async specific?

Losing Data? Async specific?

Posted Sep 25, 2025 9:50 UTC (Thu) by farnz (subscriber, #17727)
In reply to: Losing Data? Async specific? by Fowl
Parent article: Canceling asynchronous Rust

The root of the problem is that cancellation can happen unintentionally, and there isn't an exact blocking equivalent. You write code that looks "normal", but because you drop a future without polling it to completion (either via .await, or via more complex means), things get cancelled when you didn't expect them to be cancelled.

It's the equivalent of terminating a process via kill, only being done at scope ends; if your code is written to cope with that ("cancel-safe" for Rust futures), nothing bad happens. If your code has done something like "take a work item from a distributed work queue", and expects to push that work item back onto the queue if it can't finish it, you get surprising behaviour.


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds