Skip to content
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,internal/poll: reads from closed pipes sometimes do not unblock on darwin #63937

Open
bcmills opened this issue Nov 3, 2023 · 2 comments
Open
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin
Milestone

Comments

@bcmills
Copy link
Member

bcmills commented Nov 3, 2023

#!watchflakes
post <- goos == "darwin" && log ~ `os/exec\.\(\*Cmd\)\.awaitGoroutines` && log ~ `internal/poll\.\(\*pollDesc\)\.waitRead`

We have been tracking a long-running bug on macOS (darwin) in #54461 (comment). That issue title doesn't accurately capture the widespread nature of the problem, nor its defining symptom or suspected root cause; so, I am filing a new issue for it.

On macOS, we see a pattern of test failures with the following characteristics:

  • A goroutine is blocked on a read operation on a pipe.
  • The pipe is known to be closed, because the process on the other end has either terminated (most often) or explicitly closed the pipe (less frequent, but sometimes seen in cases like net/http/cgi: TestCopyError failures #57369).

Many of these bugs have been worked around by explicitly canceling (or adding a timeout to) the stuck read.

The issues with this symptom have included:

A few other issues may be related but don't (or didn't) include goroutine dumps for the stuck process: they may or may not be due to this failure mode.

Given the symptoms, it seems likely to me that this is either a bug in internal/poll, or a bug in the macOS platform that we have somehow started to trigger.

Note that #61779 was bisected specifically to https://go.dev/cl/420334.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Nov 3, 2023
@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 3, 2023
@dmitshur dmitshur added this to the Go1.22 milestone Nov 3, 2023
@mknyszek
Copy link
Contributor

mknyszek commented Nov 8, 2023

In triage, we think maybe this and the darwin memory corruption issues would be a good target for our friction fixit week time. We think the next step is to attempt to reproduce the issue in C and see if we need to escalate this as a kernel bug or something.

@bcmills
Copy link
Member Author

bcmills commented Nov 15, 2023

I randomly stumbled across #25696 today.

It isn't clear to me whether that is related, since it is using net pipes instead of os pipes. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin
Projects
Status: Todo
Status: No status
Development

No branches or pull requests

4 participants