Skip to content
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

Apparent memory leak #565

Open
ScottG489 opened this issue Jan 12, 2023 · 74 comments
Open

Apparent memory leak #565

ScottG489 opened this issue Jan 12, 2023 · 74 comments

Comments

@ScottG489
Copy link

Problem/Motivation

This addon increases in memory consumption until my system runs out.

Screen Shot 2023-01-11 at 5 50 17 PM

I've been monitoring it since my last incident and I had to restart the host. The host has a total of 4GB of memory which meets the documented requirements.

Though I've only been tracking memory per-addon for the duration of the first graph, I have been running this addon for over a year and I've only been having memory usage issues recently:

Screen Shot 2023-01-11 at 6 38 43 PM

I usually update addons pretty quickly after there's a release, and I can see v5.4.1 was released right around that time. Though from the release notes nothing sticks out.

I'm on the latest version and default config.

Expected behavior

For the memory usage of this addon to not increase indefinitely.

Actual behavior

Memory appears to increase indefinitely. Last time my system used up all memory and swap and locked up due to swap disk usage and I had to restart.

Steps to reproduce

As far as I can tell I'm using VS Code normally. I've only installed one extension (vim).

Unfortunately, I don't have any more information than above, but I'm happy to troubleshoot and get more information if you have suggestions on how to do so. I connected to the container and it doesn't have ps or even free so it seems like my tooling in the container is limited.

Thoughts on what this could be?

@leowinterde
Copy link

Same problem here.

1 similar comment
@limitless00net
Copy link

Same problem here.

@github-actions
Copy link

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Feb 16, 2023
@JonathanVarild
Copy link

Just updated my Home Assistant addons and started experiencing issues with my home "lagging". After investigating the issue, I noticed that the Visual Studio addon consumed 95% CPU and 57% ram. Turning the addon off lowered the overall resource usage on my Home Assistant system. See attached pictures.
Skärmavbild 2023-02-20 kl  19 29 49
Skärmavbild 2023-02-20 kl  19 29 25

@ScottG489
Copy link
Author

ScottG489 commented Feb 20, 2023

Still an issue.

@github-actions github-actions bot removed the stale There has not been activity on this issue or PR for quite some time. label Feb 21, 2023
@doug-hoffman
Copy link

I've also seen a memory leak...

image

image

I noticed that it started happening after I opened folder /, because I was going back and forth between editing a local addon and HA config. After switching back to /config and restarting vscode, I haven't seen the problem again.

@BNolet
Copy link

BNolet commented Mar 5, 2023

I specifically started configuring the Terminal & SSH addon to be able to use VSCode Remote - SSH specifically because of this memory issue.

My theory is that with each loading of the VSCode web interface, it's spinning up a new process without killing the old one. I say this because judging by the memory footprint over time, I can see stark stepwise jumps of memory use.

@ScottG489
Copy link
Author

@BNolet I've seen similar spike patterns as well and had also theorized that. I wonder if something changed recently with how new instances are being spun up.

I'm also considering using an external client, though I'll be using intellij instead. I've already got it working via sshfs.

@VNRARA
Copy link

VNRARA commented Mar 19, 2023

Have any of you guys been experiencing random reboots because of this maybe? My HA install has been rebooting pretty frequently and couldn't find a culprit. I've started disabling add-ons and after I noticed (see #589 as well) VSS uses port 1337 which shows up a lot in the logs.

@ScottG489
Copy link
Author

@VNRARA I've had to manually reboot my system because I ran out of memory, and soon after swap. Once everything starts swapping to disk the system essentially locks up.

I'd suggest enabling resource usage sensors for your add-ons. I've found it very valuable since I've done so. You can do this by going to the services created for each add-on and enabling the CPU and memory percent sensors.

@VNRARA
Copy link

VNRARA commented Mar 20, 2023

I think both Node-Red and VSCode might be culprits here. (I'm on a 4GB system)

image

VS code is already using: +100mb RAM from boot and Node-Red +115MB.

image
image

This also sometimes happens:

image

[02:28:34] [172.30.32.2][c05a3361][ManagementConnection] Unknown reconnection token (never seen).
[02:28:34] [172.30.32.2][e68f3661][ExtensionHostConnection] Unknown reconnection token (never seen).
[02:34:01] [172.30.32.2][e9f8b661][ManagementConnection] New connection established.
[02:34:03] [172.30.32.2][aa78680f][ExtensionHostConnection] New connection established.
[02:34:03] [172.30.32.2][aa78680f][ExtensionHostConnection] <468> Launched Extension Host Process.

@ScottG489
Copy link
Author

I think a few hundred MB for either of those is more than acceptable.

Bringing this discussion back on topic though, I'd pay attention to sustained increases to the memory usage of VS Code as an indicator that you're also seeing a memory leak.

@Xlinx64
Copy link

Xlinx64 commented Mar 20, 2023

I have the same issue on my home assistant blue, after I disabled VSCode and didn’t use it anymore I didn’t have any reboots. When I used it heavily it crashed every half an hour.

@VNRARA
Copy link

VNRARA commented Mar 20, 2023

Mine did crash so it may also be node-red

@ScottG489
Copy link
Author

@Xlinx64 Wow that's pretty bad if it happens so quickly. I'd double check the system requirements in the docs for this add-on to make sure your system meets them.

Also, here's an automation I created as a fallback to restart the add-on if it uses up too much memory. Be sure to change the value based on your system's resources:

trigger:
  - platform: numeric_state
    entity_id: sensor.studio_code_server_memory_percent
    above: 20
action:
  - service: hassio.addon_restart
    data:
      addon: a0d7b954_vscode

@Xlinx64
Copy link

Xlinx64 commented Mar 20, 2023

@ScottG489 Thank you for the script!
But I dont dare to use the add-on until it is fixed. I use the File Editor add-on for now.
I have to admit that on the day with the crashes I opened and closed it a lot since I did some template sensors.

@BNolet
Copy link

BNolet commented Mar 20, 2023

You can also use VSCode Remote - SSH with the SSH & Terminal add-on if you're looking for a longer term solution: https://community.home-assistant.io/t/vs-code-remote/129887/24?u=brandonnolet

@boojew
Copy link

boojew commented Mar 28, 2023

Yea, I have the same issue on 16gb machine.. Takes about 1-2 weeks before I run out of memory :( Could be related to coder/code-server#5201, but that is super vague.

@github-actions
Copy link

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Apr 28, 2023
@ScottG489
Copy link
Author

Still an issue.

@github-actions github-actions bot removed the stale There has not been activity on this issue or PR for quite some time. label Apr 29, 2023
@MiddleSiggy
Copy link

I am having the same issue, I posted some more information in this ticket:
coder/code-server#6213

@rbalaev
Copy link

rbalaev commented Jun 9, 2023

the same problem, until the complete loss of memory

@le-clu
Copy link

le-clu commented Jun 14, 2023

Same issue here.
I keep VSCode off, and only switch it one when needed. Today I forgot to switch it off again and had to hard-reboot my Pi.

image

@ScottG489
Copy link
Author

If you'd like to help manage this for now, you can create an automation to restart the VSCode add-on if it uses up too much memory. Something like this (adjust the above number for your situation):

trigger:
  - platform: numeric_state
    entity_id: sensor.studio_code_server_memory_percent
    above: 20
action:
  - service: hassio.addon_restart
    data:
      addon: a0d7b954_vscode

Note that you'll need to enable the memory entity for this add-on in the supervisor integration.

@github-actions
Copy link

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Jul 15, 2023
@ScottG489
Copy link
Author

Still an issue.

@github-actions github-actions bot removed the stale There has not been activity on this issue or PR for quite some time. label Jun 7, 2024
Copy link

github-actions bot commented Jul 8, 2024

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Jul 8, 2024
@Maddjik
Copy link

Maddjik commented Jul 8, 2024 via email

@mniewiera
Copy link

sadly the same for me. have to restart the addon everytime i use it.

@github-actions github-actions bot removed the stale There has not been activity on this issue or PR for quite some time. label Jul 9, 2024
Copy link

github-actions bot commented Aug 8, 2024

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Aug 8, 2024
@ScottG489
Copy link
Author

Still an issue.

@github-actions github-actions bot removed the stale There has not been activity on this issue or PR for quite some time. label Aug 13, 2024
@xamboozi
Copy link

xamboozi commented Sep 2, 2024

I'm experiencing this as well

@sinclairpaul
Copy link
Member

As it's an IDE, I'm confused by all the comments as to why you can't just stop the addon when not in use. I don't believe that the source application is designed to perpetually run.

@Maddjik
Copy link

Maddjik commented Sep 3, 2024

As it's an IDE, I'm confused by all the comments as to why you can't just stop the addon when not in use. I don't believe that the source application is designed to perpetually run.

The resource hogging happens in the first few minutes I launch the program. After 5-10 minutes, if I don't stop it my HAOS VM becomes unstable and I gotta force restart it via the hypervisor. It is literally not usable.

@Ftown14
Copy link

Ftown14 commented Sep 3, 2024

That is the problem, and you have to. It doesn't change the fact that there is a memory leak. That is why it is submitted as an issue.

@sinclairpaul
Copy link
Member

The resource hogging happens in the first few minutes I launch the program. After 5-10 minutes, if I don't stop it my HAOS VM becomes unstable and I gotta force restart it via the hypervisor. It is literally not usable.

Then it isn't the same issue as originally logged (which was an increase in memory usage over time). I would suggest looking at how you have the app configured (i.e. which folders it is running fil watchers for), and also resources on your system.

Copy link

github-actions bot commented Oct 3, 2024

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Oct 3, 2024
@le-clu
Copy link

le-clu commented Oct 3, 2024

This is still an issue.

@koyukan
Copy link

koyukan commented Oct 3, 2024

Problem still persist as of October 3, 2024

Home Assistant Supervised
Raspberry PI 4

1.2 GB Memory Usage after opening and closing 3 VSCode tabs.

image

@github-actions github-actions bot removed the stale There has not been activity on this issue or PR for quite some time. label Oct 4, 2024
@DjordjeMandic
Copy link

October 15, 2024
Everything updated to latest version
Still persists

image

@exec182
Copy link

exec182 commented Oct 20, 2024

I have the same Issue and found a bit more Information.
The Extension in VSCode "Home Assistant Config Helper" has this much load and memory usage. When i disable this extension and restart the Add-on is the Load in normal limits.

EDIT:
When i set manual the Connection for the Add-On in VSCode with a new generated Long Lived Access Token is the Issue also done.

@Dillton
Copy link

Dillton commented Nov 2, 2024

Hi.
I am joining this issue as I just by coincidence discovered my StudioCode add-on is using 107% RAM.
I am running on Intel NUC with Proxmox and HAOS in VM assigned 8GB RAM.
image

I did add-on restart and it's back in normal but question is for how long.

@ViezeVisNL
Copy link

Great to see we are going to reach a 2 year anniversary on this issue.

@vgdh
Copy link

vgdh commented Nov 2, 2024

I've stumbled on this problem with my instance.

@Dillton
Copy link

Dillton commented Nov 2, 2024

6 hours later it's growing again.
image

I don't know if this is wrong but I see it's started to complaining about some missing files.
image

@doula78
Copy link

doula78 commented Nov 3, 2024

Same issue on Studio Code Server 5.17.2 :

image

image

@pressurejets
Copy link

Same issue on Studio Code Server 5.17.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests