-
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
x/playground: falsely detects a deadlock when running Cmd.StderrPipe example code #41202
Comments
This is a bug in the faketime logic. It's now being run in a sandbox that allows interaction with external processes, but the deadlock detector assumes that's not the case, that wakeups can only come up from inside the program. Here the wakeup will come from outside the program. |
CC @aclements |
This doesn't strictly have to come from another process. e.g., https://play.golang.org/p/YLeam5VkpRZ This hits the same checkdead throw. Though in this case this is arguably helpful, since the standard behavior would be to hang forever. Note https://play.golang.org/p/TFCeA6hhJX8 does not fail. This is because there is now a M really running in a syscall, while the original example is fully blocked in netpoll. |
The fundamental problem here is that The assumption here (correct me if I'm wrong), is that at this point if none of the netpoll FDs are ready, then only a timer/sleep could be preventing forward progress, and Unfortunately, that simply isn't true in this expanded environment. Situations I can think of where this assumption breaks down:
There are a few options I see:
(3) is mostly listed as a bit of a strawman, but unless we have some sandbox-wide mechanism, there will always be cases we can't cover. If a subprocess is depending on timing of its input on some level, then faketime in the main Go program is likely to break that interaction. |
As long as there is an overall wall time limit on the playground execution, we should probably just implement time as real time there and rip out nearly all the fake time code. We could still make the time when the program begins be reported as the magic date so that caching doesn't look funny. |
Is it actually viable to run the playground in real time? I would love to drop faketime. Based on #30439 I thought there were reasons we couldn't just drop it, including the present tool. |
AIUI, there is a 5s timeout on playground execution. I'd also love to see faketime gone, but I imagine that would break lots of programs with non-trivial amounts of sleep. |
We could instrument the playground to record what fraction of executions use more than 5s of sleep. |
(And the ones that really do need 5s of sleep may not work right with fake time anyway.) |
What version of Go are you using (
go version
)?The playground
Does this issue reproduce with the latest release?
Works on latest released web site
What did you do?
Clicked "Run" on the example for Cmd.StderrPipe
What did you expect to see?
It runs
What did you see instead?
The text was updated successfully, but these errors were encountered: