async-rs / async-rs/async-std

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

Open
#1,037 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.1k
Forks
339
PR merge metrics
No merged PRs in 30d

Description

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:
```rust
#[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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.