-
Notifications
You must be signed in to change notification settings - Fork 645
go-langserver using an insane amount of cpu #1994
Comments
To first decide if this is a issue with VS Code, the Go extension or the language server, can you try with an older version of VS Code and the Go extension and check the performance? Older version of VS Code can be found in https://code.visualstudio.com/updates Older version of the Go extension can be found in https://github.com/Microsoft/vscode-go/releases |
first thing I did was to go back to VScode version from August (using same version of language server and vscode-go). Didn't need to push the investigation further, all is working well now for 30min. So it seems the regression is from VScode. I'll continue to work with this version for a while and report if things are going crazy again. |
I confirm it works perfectly with vscode |
Same issue. Just upgraded to version |
@primalmotion, @gow You opened and worked on the same project in both new and old versions of VS Code? @dbaeumer Any idea why the latest VS Code would cause such an issue? The version of language client used in the Go extension is 4.3.0 |
@ramya-rao-a I didn't explicitly go back to old version to verify. But I noticed the issue as soon as I applied the update. Everything was working just fine before I updated. |
@ramya-rao-a yes. I worked all day on the same set of workspace as usual. |
@ramya-rao-a something might have changed in VS Code which as a result pokes the server more often. One way to find this out is to enable tracing in both setups and see if there are more requests send to the server and if so which once. |
@ramya-rao-a I've updated the go-tool today average load ankur ▶ ~/Desktop/…/twoSum ▶ $ ▶ uptime
20:20:31 up 30 min, 1 user, load average: 14.81, 14.53, 11.34 process info ankur ▶ ~/Desktop/…/twoSum ▶ $ ▶ ps -eo pcpu,pid,user,args | sort -k1 -r -n | head -10
52.6 5406 ankur /usr/bin/go build -o /tmp/vscode-goKgQCYU/go-code-check .
51.6 5415 ankur /usr/bin/go vet ./...
51.4 5600 ankur /usr/bin/go build -o /tmp/vscode-goKgQCYU/go-code-check .
51.2 5596 ankur /usr/bin/go vet ./...
41.9 7757 ankur go list -e -json -compiled -test=true -export=true -deps=true -tags= -- .
41.8 7644 ankur /usr/bin/go build -o /tmp/vscode-gosPJvQE/go-code-check .
41.7 7784 ankur /usr/bin/go vet ./...
41.5 7640 ankur /usr/bin/go vet ./...
41.3 7791 ankur /usr/bin/go build -o /tmp/vscode-gosPJvQE/go-code-check .
3.7 13848 ankur /usr/lib/chromium-browser/chromium-browser --type=renderer --field-trial-handle=16958379901938881904,8968544606741407184,131072 --service-pipe-token=7304318142105071701 --lang=en-US --enable-offline-auto-reload --enable-offline-auto-reload-visible-only --num-raster-threads=2 --enable-main-frame-before-activation --service-request-channel-token=7304318142105071701 --renderer-client-id=45 --shared-files=v8_context_snapshot_data:100,v8_natives_data:101 Next highest usage after Observation: Multiple go version CPU Consuming most time in the User Space ankur ▶ ~/Desktop/…/twoSum ▶ $ ▶ mpstat
Linux 4.15.0-36-generic (thinkpad-e470) 10/17/2018 _x86_64_ (4 CPU)
08:17:21 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
08:17:21 PM all 78.19 0.06 3.00 0.26 0.00 0.22 0.00 0.00 0.00 18.27 @dbaeumer I closed the vscode process and waited for 15min but the CPU load never went down. And this issue started coming after tool update only. |
I confirmed that VS Code |
@ankur-anand This issue is tracking the problem of the Go language server consuming a lot of CPU where as your issue is independent of the Go language server, therefore can you please log a separate issue and we can take it from there? |
there is a related issue there sourcegraph/go-langserver#209 |
having same issue, for me os crashed sourcegraph/go-langserver#336 |
@huttarichard Do you also not see the problem in 1.27.2? You can get the older version from https://code.visualstudio.com/updates/v1_27 |
@ramya-rao-a I can confirm, so far did not happen |
I am only using vs code with Go for a couple of weeks and using langserver was always causing huge CPU spikes and memory consumption. VS code version Attaching cpu and heap profiles if that might help anyone. (while creating the heap profile langserver was using around 14 gigs of memory - at least that's what Activity Monitor said) pprof.alloc_objects.alloc_space.inuse_objects.inuse_space.001.pb.gz |
@pmalekn Can you also check if you see the same when using VS Code 1.27? https://code.visualstudio.com/updates/v1_27 Also give the Insiders a try |
@ramya-rao-a 1.27.2 seems better after using it for a while but I wouldn't like to bet on it. I've left |
still miserable with vscode The only way to make this manageable is to run:
|
@primalmotion Does this occur even in simple small code bases? If not, then can you point me to a codebase where you see this consistently? What worries me is that this is a recent issue with recent VS Code versions. So even though there is a tracking issue in the language server repo, this can be something triggered by a recent change in VS Code itself. |
@ramya-rao-a I mostly work on our internal projects so I don't have much to share. It happens on large codebase or small libs. But from my experimentations yeah it seems to be VSCode as when I downgraded, even with latest But I don't notice any spamming of any sort in the |
@ramya-rao-a I have been closely looking at this because it has been significantly hampering my development. I looked closely, for example at the traces of the langserver. One odd thing stood out - currently, when I am typing in the code editor, it seems that vscode sends a Is this by the protocol design? Can this be, in some ways debounced and so the messages only sent after a minimum x millis? Can this be configurable? Like, if I want to only care about getting popup help after I pause typing for 500ms? I am just guessing out there, that a possible edge case is being triggered in the lang server because two many requests are being sent for the same document, and we can reduce this a bit by asking langserver less frequently by cutting down on obvious unnecessary calls. |
@jrieken could this (microsoft/vscode#47265) be caused by the outline view? |
@sandipb Thats a good observation. Disable both the outline view in the explorer viewlet and the breadcrumbs feature and see if that makes any difference. Outline view:
Breadcrumbs:
@primalmotion Can you try the same? |
Lol. I didn't even know that Breadcrumbs was a feature. Didn't have it on. Just now had an editing session with the outline disabled. Still had the issue with langserver. Is there a way to force the outline view to use the default outline cli ( |
The outline view in the explorer uses the same code that powers the
Keep the outline view and breadcrumbs disabled, kill the current language server process and try again just to be sure. When you observed the trace logs in #1994 (comment), did you by any chance get to compare it with the logs you get when using the older VS Code |
We have shipped outline view in summer and we didn't change how it schedules its updates. I'd be surprised if this is coming only now. |
I tried to disable breadcrumb and outline view, doesn't improve anything for me |
I have the same issue, did someone fix this problem? |
It looks like everybody is just waiting for the official Go langserver to be released, which could be a while. Even over on Sourcegraph's repository, they are advocating just waiting for the official server to ship. Still, it's not helpful in the interim for us suffering from this bug. |
we're getting closer sourcegraph/go-langserver#209 (comment) |
Closing this issue as we have now moved to suggesting For more on language server integration with this extension, please see Go language server To go a feature request for gopls, use the Go issue tracker |
Since the last upgrade of vscode/vscode-go go-langserver is using an insane amount of cpu after a few minutes of use (from 400% to 700%)
my config did not change, and I run update tools command
Here's the relevant part of it
The text was updated successfully, but these errors were encountered: