Skip to content

Receiver::recv_timeout() returns instantly when duration overflows #44216

Closed
@vandenoever

Description

When Receiver::recv_timeout receives certain large values, it returns immediately. This is probably due to an overflowing value. Instead, when there is overflow, it should fall back to Receiver::recv.

use std::sync::mpsc::Receiver;
use std::time::Duration;

let max = Duration::from_secs(u64::max_value());
receiver.recv_timeout(max);

Instant should probably not overflow like this:

let now = Instant::now();
let end_of_time = Instant::now() + Duration::from_secs(u64::max_value());
println!("{:?}", now);
println!("{:?}", end_of_time);
println!("did we pass end of time? {}", now > end_of_time);

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions