Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid time operations that can panic #599

Merged
merged 1 commit into from Feb 1, 2022

Commits on Jan 31, 2022

  1. Avoid time operations that can panic

    We have reports of runtime panics (linkerd/linkerd2#7748) that sound a
    lot like rust-lang/rust#86470. We don't have any evidence that these
    panics originate in h2, but there is one use of `Instant::sub` that
    could panic in this way.
    
    Even though this is almost definitely a bug in Rust, it seems most
    prudent to actively avoid the uses of `Instant` that are prone to this
    bug. These fixes should ultimately be made in the standard library, but
    this change lets us avoid this problem while we wait for those fixes.
    
    This change replaces uses of `Instant::elapsed` and `Instant::sub` with
    calls to `Instant::saturating_duration_since` to prevent this class of
    panic.
    
    See also hyperium/hyper#2746
    olix0r committed Jan 31, 2022
    Copy the full SHA
    a2f783c View commit details
    Browse the repository at this point in the history