Closed joaomoreno closed 6 months ago
Ah! Shared process does crash, this is in the main log:
Anything in Crashpad/pending
around the timestamp of the crash ?
Found out why I had no crash reports: https://github.com/microsoft/vscode/issues/212671
Here it is!
I'm getting different crash reasons actually. Just happened again last night. Out of memory? Weird.
We might actually have a memory leak here. I'll be recording the total memory allocated for the shared process along the day and plotting it. Here's the first 20 minutes, not looking great:
Mostly related:
I discovered a bug yesterday that caused the extension to download itself repeatedly until it succeeded - https://github.com/microsoft/vscode/blob/c06c555b481aaac4afd51d6fc7691d7658949651/src/vs/platform/extensionManagement/node/extensionManagementService.ts#L984 - This could also crash the shared process, but only when the download fails.
I fixed it yesterday.
@joaomoreno Lets check the memory chart today with today's insider.
Thanks @deepak1556 for showing me how to attach devtools to the shared process. Details:
code --inspect-sharedprocess=9229
Indeed an allocation timeline quickly shows bursts of memory allocation every time I focus VS Code back from another app. In the following recording, I focused it three times. Each of these are ~60MB of memory that won't ever be garbage collected.
This is related to settings embeddings:
I could only find the string settingEmbeddings
in copilot chat. @lramos15 this appears to be your land. Any thoughts on why (1) this huge string makes it into the shared process and (2) hangs around forever to the point of crashing the shared process?
🥳 Alright, root cause found!
TL;DR Instantiation services now hold on to their children, which surfaces a memory leak in a part of the Settings Sync area which runs in the shared process.
I am the only one who seems to repro this due to the following snowflake conditions:
In essence:
createChild
calls and make sure dispose()
is eventually called: https://github.com/microsoft/vscode/issues/212879Throughout a normal day, in which I focus in and out of VS Code multiple times, these incremental 60MB allocations would eventually result in a OOM crash. 💥
A couple more follow up items:
cache
map from the Storage
class, when it's disposed?
From https://github.com/microsoft/vscode/issues/212103
It's happened to me at least 4 times in the last 2 weeks, I open up a previously running Code Insiders and the extension view loads forever. The process explorer shows that the shared process is gone. There are no crashes in
Crashpad/completed
.