-
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
cmd/compile, x/sync/errgroup: TestWithContext failing after devirtualization CL #42284
Comments
Now that #42279 is resolved, is this still an issue? I'm not sure I understand how this issue is different. |
See https://build.golang.org/?repo=golang.org%2fx%2fsync; the page is all red on tip. |
Thanks. I can reproduce locally:
|
Change https://golang.org/cl/266518 mentions this issue: |
Sorry, missed this yesterday. Investigating. |
A workaround for the issue would be to to modify
It's a compiler bug that the current code (i.e., reassigning ctx) is miscompiled, but this change would be desirable anyway because it would play better with the current devirtualization code. |
Reassigning over |
Change https://golang.org/cl/266618 mentions this issue: |
Once we move escape analysis to SSA, this should be straightforward to handle. But right now, the Node AST doesn't make it easy to do. We'd have to effectively reimplement SSA renaming in the frontend. |
Ah, I had no idea this was at the AST level where you couldn't distinguish it. Clearly I'm not paying enough attention during your streams. 🙂 |
@mdempsky I'm really excited that we're getting these devirtualization optimizations and there are several places in my own code where I anticipate them making a big difference. That said, it's a little concerning when an optimization applies only when code is written in a non-standard (and arguably worse) way. Depending on how many release cycles the devirtualization handles the |
@cespare That's a fair point. There's certainly a trade off though: the more effort put into improving the early devirtualization code is effort taken away from moving escape analysis to SSA. The current early devirtualization pass is basically just a minor extension of the inlining / escape analysis improvements implemented for #41474 If you do see that practice developing, let us know and we can revisit whether there are more cases that we can handle without too much trouble. |
I might be off base here, disregard if so, but this ticket is the one search result for
and I'm hitting it, so thought it may be related. It's unfortunately deeply nested in use (websocket library used by a Discord client library), I'm not quite able to extract a simple repro yet, and I'm on ARM64. Not a support request, just dropping this in case it's useful. Here's the line that it hits on: case <-readCtx.Done(): I've tried to extract this into a self-contained reproduction, but it doesn't fail :( Here's what it looks like running: $ ~/Code/gopath/bin/gotip version
go version devel +55b5801 Sat Dec 19 00:20:38 2020 +0000 darwin/arm64
$ ~/Code/gopath/bin/gotip run main.go
panic: interface conversion: context.Context is *context.cancelCtx, not *context.emptyCtx
goroutine 66 [running]:
nhooyr.io/websocket.(*Conn).timeoutLoop(0x140000141a0)
/Users/kameliya/Code/gopath/pkg/mod/nhooyr.io/[email protected]/conn_notjs.go:161 +0x3d0
created by nhooyr.io/websocket.newConn
/Users/kameliya/Code/gopath/pkg/mod/nhooyr.io/[email protected]/conn_notjs.go:114 +0x37c
exit status 2 |
@kivikakk Thanks for the report! I was able to create a reproducer. |
Nice, thank you! I'll watch with interest. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
In the
golang.org/x/sync/errgroup
package, rungo test
.What did you expect to see?
Passing tests.
What did you see instead?
https://build.golang.org/log/8759ffb3dd087325958f6d2d67773f3dd2f70cf2
https://build.golang.org/log/32b25547fddc3b46c217c9efffb9aa124df3766e
The dashboard shows this test consistently failing after the devirtualization CL, but this differs from #42279 as it affects runtime behavior.
cc @mdempsky
The text was updated successfully, but these errors were encountered: