golang/go

syscall: treat ENFILE as a temporary error, like EMFILE

Open

#35,131 创建于 2019年10月24日

在 GitHub 查看
 (19 评论) (0 反应) (0 负责人)Go (19,008 fork)batch import
NeedsFixOS-Windowshelp wanted

仓库指标

Star
 (133,883 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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.

贡献者指南