-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
os: remove ErrTimeout in Go 1.13 #33411
Comments
The current plan for net.Error in 1.13, which touches syscall.Errno and os.SyscallError is here: #31449 (comment) /cc @ianlancetaylor |
Unwrapping aside, It seems clearly necessary for the |
@neild, this is part of why I argued in #32463 (comment) that if errors.Find(err, os.ErrTimeout) { reads a lot more naturally to me than if errors.Is(err, os.ErrTimeout) { The existence of the I do not understand why it is appropriate for the |
To be clear, the resolution I would prefer for this issue is:
That would restore the |
@bcmills It seems to me that it is clearly too late in the 1.13 release cycle to add For 1.13 we need to decide on |
Yes, you're probably right about that. But users can always write the equivalent loop themselves. So in the interim, I think it would be better to remove |
FWIW, a function like |
If I understand the implemented behavior of It is my understanding that, as implemented today, all other error/predicate combinations in the
|
I am OK with looking at removing ErrTimeout until we understand better whether to strengthen net.Conn's behavior for deadlines (see #31449). Until things settle down, people who want to do IsTimeout with unwrapping can use
@neild, do you have time to put together a CL with the implications of removing ErrTimeout? |
Change https://golang.org/cl/188758 mentions this issue: |
@rsc https://golang.org/cl/188758 removes ErrTimeout. This is mostly a partial rollback of https://golang.org/cl/170037. |
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 usingerrors.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
The text was updated successfully, but these errors were encountered: