Commit 17190de0 authored by Lorenz Bauer's avatar Lorenz Bauer Committed by Ian Lance Taylor

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: default avatarIan Lance Taylor <iant@golang.org>
parent f4e32aee
......@@ -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")
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment