mirror of
https://github.com/golang/go
synced 2024-11-18 09:04:49 -07:00
syscall: treat ENFILE as a temporary error
ENFILE is returned from accept when the whole system has run out of file descriptors. Mark the error as temporary, so that accept loops continue working. Fixes #35131 Updates #1891 Change-Id: Idf44c084731898ff4c720d06c250d3b8a42de312 Reviewed-on: https://go-review.googlesource.com/c/go/+/203117 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
f4e32aeed1
commit
17190de085
@ -138,7 +138,7 @@ func (e Errno) Is(target error) bool {
|
||||
}
|
||||
|
||||
func (e Errno) Temporary() bool {
|
||||
return e == EINTR || e == EMFILE || e.Timeout()
|
||||
return e == EINTR || e == EMFILE || e == ENFILE || e.Timeout()
|
||||
}
|
||||
|
||||
func (e Errno) Timeout() bool {
|
||||
|
@ -384,3 +384,9 @@ func TestSetsockoptString(t *testing.T) {
|
||||
t.Fatalf("SetsockoptString: did not fail")
|
||||
}
|
||||
}
|
||||
|
||||
func TestENFILETemporary(t *testing.T) {
|
||||
if !syscall.ENFILE.Temporary() {
|
||||
t.Error("ENFILE is not treated as a temporary error")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user