golang/go

syscall: treat ENFILE as a temporary error, like EMFILE

Open

#35,131 opened on Oct 24, 2019

View on GitHub
 (19 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
NeedsFixOS-Windowshelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Linux

What did you do?

One of our servers ran out of file handles (/proc/sys/fs/file-max). This led net.Listener.Accept() to return ENFILE (not EMFILE). Since ENFILE is not considered a temporary error, http.Server.Serve exited it's accept loop and returned ENFILE.

What did you expect to see?

ENFILE should be treated as temporary if returned by accept (and possible others). http.Server should not abort its accept loop when encountering ENFILE.

What did you see instead?

The application which received ENFILE logged the error, and continued running without a working listener / http server. If the application had followed the common log.Fatalln(http.Serve(...)) it would have crashed.

Contributor guide