os: OpenFile issue on darwin: 100% CPU on pty master read #22099
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
OS-Darwin
Milestone
Go version:
go version go1.9 darwin/amd64
os.OpenFile calls os.newFile with
pollable
always true. (go/src/os/file_unix.go
Line 186 in 9f7fd89
On darwin, open
/dev/ptmx
fails to set the non-blocking flag, however, the subsequent slaves work fine. (go/src/os/file_unix.go
Lines 105 to 119 in 9f7fd89
My guess is that having the slave in non-blocking mode is the reason why read on the master takes 100% CPU.
Details of the issue: kr/pty#52
Quickfix: kr/pty#53
Is it expected always set the poller when using os.OpenFile? Maybe we should take a look at the flags and see if there is O_NONBLOCK instead of forcing it or maybe introduce a new flag to toggle the poller?
To reproduce on darwin: https://play.golang.org/p/rq8pJGL3ey
The text was updated successfully, but these errors were encountered: