-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os: Read() blocking on named pipe despite O_NONBLOCK #66239
Comments
!!! Latest updates:
I've figured it out! When there is no go/src/internal/poll/fd_unix.go Lines 163 to 166 in 78755f6
and block infinitely cuz the last writer to a FIFO does not trigger a The combination of CL 118566 and CL 156379 disabled the registration to netpoller for some specific fds of Besides, the comments: Lines 180 to 185 in 48b10c9
It seems to be outdated after all those CLs mentioned above and should be removed or updated. Even so, I still don't see why removing the
I've drafted a CL for this, working on it. |
Change https://go.dev/cl/570397 mentions this issue: |
Go version
go version go1.22.1 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
When calling
os.Read()
on a named pipe withO_NONBLOCK
, that call will sometimes block. I only see the the bug on my M1 Mac. When I run this code in Linux or in the go playground, I do not see the bug. Here is a full program to reproduce:https://go.dev/play/p/Ryc4jmgag3t
What did you see happen?
What did you expect to see?
I expected to see the same output as above, plus the following lines looped infinitely:
This program does behave the way I'd like if I make any of these changes:
os.OpenFile()
andos.File.Read()
withsyscall.Open()
andsyscall.Read()
, then the program does work as expected on Mac. It does not block, and it loops infinitely. Here is an example: https://go.dev/play/p/cflSTMW3RCktime.Sleep()
in the goroutine, then the program also works as expected.The text was updated successfully, but these errors were encountered: