code-server icon indicating copy to clipboard operation
code-server copied to clipboard

[Bug]: Memory leak addon_####_vscode chews up all system memory then crashes system

Open MiddleSiggy opened this issue 1 year ago • 7 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

OS/Web Information

  • Web Browser: Chrome
  • Local OS: (my PC) Windows 10
  • Remote OS: HA (running on HA in VMware)
  • Remote Architecture: Alpine Linux

code-server: v4.11.0 Code: 1.76.1 Commit: 5e805b79fcb6ba4c2d23712967df89a089da575b Date: 2023-03-14T20:11:32.198Z Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36

Steps to Reproduce

  1. Open Studio Code Server in Home Assistant
  2. Wait...
  3. Add-On will chew up all available memory then crash the system

9:38 am - started Studio code Server - just let sit in window (130MB Memory) image

10:09 am - still just sitting there (3.23 GB Memory) image

Expected

It should use the necessary memory and not kill the system

Actual

it uses all the memory eventually and the system crashes

Logs

Not sure how to do that under HA

Screenshot/Video

No response

Does this issue happen in VS Code or GitHub Codespaces?

  • [X] I cannot reproduce this in VS Code.
  • [X] I cannot reproduce this in GitHub Codespaces.

Are you accessing code-server over HTTPS?

  • [X] I am using HTTPS.

Notes

HA is NOT using HTTPS: [2023-05-16T04:33:05.794Z] info HTTP server listening on http://0.0.0.0:1337/ [2023-05-16T04:33:05.794Z] info - Authentication is disabled [2023-05-16T04:33:05.794Z] info - Not serving HTTPS

Not sure how to make that happen, I added in NGINX to proxy connections and when I did that I believe the problem started and it stopped sharing HA with HTTPS.

Let me know how I can help resolve the issue

MiddleSiggy avatar May 16 '23 14:05 MiddleSiggy

I'm Assuming this is the same issue. The first time I launch the addon the CPU is 50% and 10% memory - Second is the picture. Each time it launches memory increases until maxed out.

image

s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
-----------------------------------------------------------
 Add-on: Studio Code Server
 Fully featured Visual Studio Code (VSCode) experience integrated in the Home Assistant frontend.
-----------------------------------------------------------
 Add-on version: 5.5.7
 You are running the latest version of this add-on.
 System: Home Assistant OS 10.1  (amd64 / qemux86-64)
 Home Assistant Core: 2023.5.3
 Home Assistant Supervisor: 2023.04.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-timezone: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
[10:48:34] INFO: Configuring timezone (America/New_York)...
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service base-addon-timezone successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-user: starting
s6-rc: info: service init-mysql: starting
s6-rc: info: service init-mosquitto: starting
s6-rc: info: service init-code-server: starting
s6-rc: info: service init-code-server successfully started
s6-rc: info: service init-mysql successfully started
s6-rc: info: service init-user successfully started
s6-rc: info: service code-server: starting
s6-rc: info: service code-server successfully started
[10:48:35] INFO: Starting code-server...
s6-rc: info: service init-mosquitto successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[2023-05-19T14:48:36.984Z] info  Wrote default config file to ~/.config/code-server/config.yaml
[2023-05-19T14:48:37.708Z] info  code-server 4.11.0 85e083580dec27ef19827ff42d3c9257d56ea7e3
[2023-05-19T14:48:37.710Z] info  Using user-data-dir /data/vscode
[2023-05-19T14:48:37.738Z] info  Using config file ~/.config/code-server/config.yaml
[2023-05-19T14:48:37.738Z] info  HTTP server listening on http://0.0.0.0:1337/
[2023-05-19T14:48:37.738Z] info    - Authentication is disabled
[2023-05-19T14:48:37.738Z] info    - Not serving HTTPS
[10:58:33] 
[10:58:33] Extension host agent started.
[10:58:34] [172.30.32.2][be8b9fde][ManagementConnection] New connection established.
[10:58:35] [172.30.32.2][cdffa3ac][ExtensionHostConnection] New connection established.
[10:58:35] [172.30.32.2][cdffa3ac][ExtensionHostConnection] <416> Launched Extension Host Process.
File not found: /usr/local/lib/code-server/lib/vscode/extensions/keesschollaart.vscode-home-assistant-1.35.1/jinja-language-configuration.json
[10:58:42] [172.30.32.2][be8b9fde][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[10:58:42] [172.30.32.2][cdffa3ac][ExtensionHostConnection] <416> Extension Host Process exited with code: 0, signal: null.
[10:58:55] [172.30.32.2][bdf239be][ManagementConnection] New connection established.
[10:58:56] [172.30.32.2][c405e1d5][ExtensionHostConnection] New connection established.
[10:58:56] [172.30.32.2][c405e1d5][ExtensionHostConnection] <492> Launched Extension Host Process.
File not found: /usr/local/lib/code-server/lib/vscode/extensions/keesschollaart.vscode-home-assistant-1.35.1/jinja-language-configuration.json
[10:59:02] [172.30.32.2][bdf239be][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[10:59:02] [172.30.32.2][c405e1d5][ExtensionHostConnection] <492> Extension Host Process exited with code: 0, signal: null.
[10:59:29] [172.30.32.2][f485f479][ManagementConnection] New connection established.
[10:59:30] [172.30.32.2][be845e70][ExtensionHostConnection] New connection established.
[10:59:30] [172.30.32.2][be845e70][ExtensionHostConnection] <568> Launched Extension Host Process.
File not found: /usr/local/lib/code-server/lib/vscode/extensions/keesschollaart.vscode-home-assistant-1.35.1/jinja-language-configuration.json
[10:59:33] [172.30.32.2][f485f479][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
Error: Unexpected SIGPIPE
    at process.<anonymous> (/usr/local/lib/code-server/lib/vscode/out/bootstrap.js:1:419)
    at process.emit (node:events:525:35)
[10:59:33] Error: Unexpected SIGPIPE
    at process.<anonymous> (/usr/local/lib/code-server/lib/vscode/out/vs/server/node/server.main.js:161:6350)
    at process.emit (node:events:525:35)
[10:59:33] [172.30.32.2][be845e70][ExtensionHostConnection] <568> Extension Host Process exited with code: 0, signal: null.```

yestrdave avatar May 19 '23 15:05 yestrdave

Seems to be the issue, I have found if I do not go into VCS then my home assistant does not run out of memory, otherwise it will run out of memory in a few hours.. But I have 16GB!!!!

MiddleSiggy avatar May 19 '23 20:05 MiddleSiggy

Yes I have found the same. 32GB here. However I have the VMM capped at 6GB.

yestrdave avatar May 19 '23 20:05 yestrdave

Doing the same thing with 5.6.0 release

yestrdave avatar May 21 '23 02:05 yestrdave

I have no immediate ideas on what could cause this...for now I think the path forward is to try reproducing outside of HA and then see if we can do some profiling.

code-asher avatar May 22 '23 20:05 code-asher

Below is current build I am running. I uninstalled Code Server, rebooted HA. then reinstalled and the processor and memory errors seamed to have stopped. image

yestrdave avatar May 26 '23 16:05 yestrdave

I meet the same problem, memory leak . I use the code-server below as: """ Web Browser: google 88.0.4324.104 Local OS: WIN10 Remote OS: Ubuntu 16.04 Remote Architecture: X86 code-server --version: code-server: v4.8.3 Code: 1.72.1 -python:3.9 """

About 3 weeks , memory leak of >15GB, i have to restart the code-server service, the memory release immediately.

And i found a phenomenon, when i use the code-server run (python) code, memory will leak. But when i use the code-server NOT run code, memory not leak.

wqhcug avatar Aug 16 '23 07:08 wqhcug