async-std icon indicating copy to clipboard operation
async-std copied to clipboard

`future::timeout` panics when provided with large timeouts

Open patrickfreed opened this issue 2 years ago • 2 comments

The async_std::future::timeout function panics if a large duration is provided. This should either be documented as a possible panic conditon or changed to no longer panic.

Repro:

#[async_std::main]
async fn main() -> anyhow::Result<()> {
    async_std::future::timeout(Duration::MAX, async {}).await;
    Ok(())
}

Looks like the cause is an unchecked add in smol: https://github.com/smol-rs/async-io/blob/master/src/lib.rs#L162

patrickfreed avatar Aug 19 '22 16:08 patrickfreed

It seems like this was fixed upstream in async-io - https://github.com/smol-rs/async-io/pull/87 - pending a release of that crate.

Fishrock123 avatar Sep 01 '22 06:09 Fishrock123

With the newest release of async-io, this issue should be fixed now.

notgull avatar Dec 14 '22 20:12 notgull