Skip to content

os: remove ErrTimeout in Go 1.13 #33411

Closed
@FiloSottile

Description

@FiloSottile

Extracting #32463 (comment) and #32463 (comment) from #32463, which was closed by removing ErrTemporary.

We've seen net.Error.Timeout() become nearly useless because it got overloaded with too many different (and requiring different handling) timeout errors. Did a DNS request timeout, requiring a retry of the Dial? Did the keep-alive hit, breaking the connection? Did the deadline hit, meaning the Read can be retried after resetting it? Did a timeout happen that caused a fatal error that can't be retried? (More at #31449.)

I don't think there would be a semantic meaning to os.ErrTimeout either, except being something that's called a timeout. Adding a single ErrTimeout to the standard library would encourage lack of specificity, without having any upside, because errors.Is(err, ErrTimeout) doesn't mean anything. Libraries and applications are better off using errors.New("this specific action timed out") or defining their own timeout errors.

Instead, we should maybe have net.DeadlineExceeded, which can always be handled by resetting a deadline.

/cc @rsc @bcmills

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions