-
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
runtime: Go 1.14 is extremely slow under debugging on macOS #37528
Comments
/cc @aclements @mknyszek |
What debugger are you using? LLDB? On my mac, it is clearly slower under lldb but not that slow. I see 10X-30X slowdown.
GDB on Linux doesn't show any slowdown. Maybe LLDB's signal handling on darwin is not very efficient? |
If anyone can provide detailed actually-working instructions (a shell script would be ideal, "frab the gnobulator"-style instructions are less helpful) on how to get gdb working on Darwin, then I could perhaps answer that question. Till then, I can report that "no slowdown was observed" (because there are no observations at all). |
I'm using the Delve debugger with default options:
|
Here's a reproduction script: https://gist.github.com/Cyberax/693f1d1f2c4550478615047e8ca866e0 Output:
With preempt off:
|
It has something to do with asynchronous preemption, not sure what. |
I think this might have something to do with somewhat unusual stack arrangement. The reproduction case creates an array of slices into a large array. As far as I remember, asyncpreempt treats stack conservatively during GC pauses which would cause a lot of unnecessary work I've tested this hypothesis by running with GOGC=off and it indeed fixes the issue:
|
I don't think conservative stack scan causes this. It is the same amount of work, under the debugger or not. My guess is that with GC off, there are fewer preemption happened, as a source of preemptions is the GC trying to stop the goroutine to scan the stack or stop the world. |
The workaround with disabling the asyncpreemt works, closing the issue. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
After upgrade to 1.14 our application became unusable in a debugger with asynchronous preemption turned on. It's sometimes 1000 times slower than with the
asyncpreempt=off
.You can try this program: https://play.golang.org/p/k3fnAt18hcO Normally it runs in under <4ms on my computer but under a debugger it runs in 500-2000ms.
What did you expect to see?
Normal speed.
What did you see instead?
Elapsed 1433 ms
The text was updated successfully, but these errors were encountered: