vscode: tslintServer.js and tsserver.js has memory leak

the memory allocated to electron_node tslintServer.js keep increasing until all memory used by it.

update: Then I removed this plugin, then after restart the tsServer.js keep allocating memory.

update 2: I find I installed tslint deprecated plugin. I uninstall it and install the latest version.

Now the problem became tsserver.js has memory leak

update 3: I downgrade to vs to: Version: 1.39.2 Commit: 6ab598523be7a800d7f3eb4d92d7ab9a66069390 There is no memory leak problem in this version.

Bug happened on version:

Version: 1.40.2 Commit: f359dd69833dd8800b54d458f6d37ab7c78df520 Date: 2019-11-25T14:54:40.719Z Electron: 6.1.5 Chrome: 76.0.3809.146 Node.js: 12.4.0 V8: 7.6.303.31-electron.0 OS: Linux x64 4.9.0-9-amd64

Steps to Reproduce: unknown, after upgrade to this version, when tslint start work, it keep eat the memory until all memory used.

Does this issue occur when all extensions are disabled?: No

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 14
  • Comments: 35 (9 by maintainers)

Most upvoted comments

The number of issues related to this is growing. This is definitely a VSCode issue. The tsserver.js process is ignoring the new --max_old_space_size parameter and using up as much RAM as possible.

Our current VS Code 1.43 insiders build now include Electron 7 which has the fix.

Let me know if you still see this issue using VS Code 1.43+

It is a V8 bug and Google has just fixed it, see my detailed analysis https://gist.github.com/likev/2521f6cde21215e8fe6f53d4c6370fa8

maybe we need a feature that limiting the maximum vscode memory usage,

and dump related info for debugging automatically to help the ms team to fix it.

update: I created a feature request for this:

https://github.com/microsoft/vscode/issues/86746

@1011178l Do you also have tslint installed? Please share the output of code-insiders --status

Hi I have tslint installed, the latest version. the problem not always happen, but once it happens, it is too late to run any command until there is no memory left, then the system kill the vscode.

I will try to make it, but I see lots of people has the same issue.

Thanks.

Visual Studio Code almost killed my Kubuntu 18.04 machine with 32GB of memory 3 times today. Although system was extremely unresponsive I manged (I had to resist the urge to just reset the system) to trigger “kill window” functionality (Alt+Ctrl+Esc) and click Visual Studio Code window each time. As a result, RAM was cleaned up and I could continue working.


EDIT 3

For avoiding lockdown due to RAM shortage this command can be used on Linux (tried it with Ubuntu 18.04 LTS, should work on other systemd-based distributions):

# You will be asked to enter your user password, *not* root password
# There is no need to run this as root!
systemd-run --scope -p MemoryLimit=10G code

I didn’t see any side effects versus running the code directly so far.

I noticed that the previous version has no problem, and the difference between them is the Electron version. before is Electron 4, and the 1.40.2 use Electron: 6.1.5 could this be a problem?

$ code --status

Version:          Code 1.40.2 (f359dd69833dd8800b54d458f6d37ab7c78df520, 2019-11-25T14:54:45.096Z)
OS Version:       Windows_NT x64 10.0.18363
CPUs:             Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz (4 x 2592)
Memory (System):  7.44GB (0.51GB free)
VM:               0%
Screen Reader:    no
Process Argv:
GPU Status:       2d_canvas:                     enabled
                  flash_3d:                      enabled
                  flash_stage3d:                 enabled
                  flash_stage3d_baseline:        enabled
                  gpu_compositing:               enabled
                  metal:                         disabled_off
                  multiple_raster_threads:       enabled_on
                  oop_rasterization:             disabled_off
                  protected_video_decode:        unavailable_off
                  rasterization:                 enabled
                  skia_renderer:                 disabled_off
                  surface_control:               disabled_off
                  surface_synchronization:       enabled_on
                  video_decode:                  enabled
                  viz_display_compositor:        enabled_on
                  viz_hit_test_surface_layer:    disabled_off
                  webgl:                         enabled
                  webgl2:                        enabled

CPU %   Mem MB     PID  Process
    0       49   21740  code main
    0       98    3108     gpu-process
    0       30    8920     shared-process
    0      394   12720     window (鈼?dashboard.ts - bi4.0 (宸ヤ綔鍖? - Visual Studio Code)
    0        3    1656       console-window-host (Windows internal process)
    0      901    3792       extensionHost
    0        7    3420         "D:\Program Files\Microsoft VS Code\Code.exe" "d:\Program Files\Microsoft 
VS Code\resources\app\extensions\html-language-features\server\dist\htmlServerMain" --node-ipc --clientProcessId=3792
    0       47    9868         electron_node tsserver.js
    0       15   11256         D:\succezIDE\jdk\jdk1.8.0_60\bin\java -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dfile.encoding=utf8 -DwatchParentProcess=false -noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication -jar 
c:\Users\luoxiao\.vscode\extensions\redhat.java-0.54.2\server\plugins\org.eclipse.equinox.launcher_1.5.600.v20191014-2022.jar -configuration c:\Users\luoxiao\.vscode\extensions\redhat.java-0.54.2\server\config_win -data c:\Users\luoxiao\AppData\Roaming\Code\User\workspaceStorage\0356150a0b142033ba83af3b08b6111a\redhat.java\jdt_ws
    0        3    3296           console-window-host (Windows internal process)
    0       58   12336           electron_node local-mysql-succbidev.js
    0        1    2084             console-window-host (Windows internal process)
   74     3088   18648         electron_node tsserver.js
    0        0    9848           electron_node typingsInstaller.js typesMap.js
    0        5   20508         "D:\Program Files\Microsoft VS Code\Code.exe" "d:\Program Files\Microsoft 
VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain" --node-ipc --clientProcessId=3792
    0        7   20584         "D:\Program Files\Microsoft VS Code\Code.exe" "d:\Program Files\Microsoft 
VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain" --node-ipc --clientProcessId=3792
    0        4    4116       searchService
    0       10   11596       watcherService
    0        2   13588       console-window-host (Windows internal process)
    0        3   15768       "C:\Program Files\Git\bin\bash.exe"
    0        4   17312         "C:\Program Files\Git\bin\..\usr\bin\bash.exe"
    0        1   19724       "C:\Program Files\Git\bin\bash.exe"
    0        5   22372         "C:\Program Files\Git\bin\..\usr\bin\bash.exe"
    0       12   15036     electron-crash-reporter

Workspace Stats:
|  Window (鈼?dashboard.ts - bi4.0 (宸ヤ綔鍖? - Visual Studio Code)
|    Folder (XXX): 0 files
|      File types:
|      Conf files:
|    Folder (XXX): 0 files
|      File types:
|      Conf files:
|    Folder (XXX): 0 files
|      File types:
|      Conf files:
|    Folder (XXX): 0 files
|      File types:
|      Conf files:
|    Folder (XXX): 62 files
|      File types: svg(24) json(9) ts(9) png(6) md(4) gitattributes(1)
|                  gitignore(1) vscodeignore(1)
|      Conf files: package.json(1) tsconfig.json(1) settings.json(1)
|                  tasks.json(1) launch.json(1)
|      Launch Configs: extensionHost(2)
|    Folder (XXX): 449 files
|      File types: ts(291) js(21) json(4) gitignore(1) less(1)
|      Conf files: package.json(1) tsconfig.json(1) settings.json(1)
|    Folder (XXX): 870 files
|      File types: md(456) png(170) gif(31) pptx(8) json(7) js(4) ts(4)
|                  styl(2) yml(1) lock(1)
|      Conf files: package.json(3) tsconfig.json(1) launch.json(1)
|                  settings.json(1)
|      Launch Configs: node(2)
|    Folder (XXX): 3742 files
|      File types: class(1655) java(1372) xml(70) txt(56) properties(22)
|                  svg(16) csv(12) DBF(10) sql(6) png(6)
|      Conf files:
|    Folder (XXX): 15125 files
|      File types: svg(2799) class(1378) json(1241) java(1161) ts(894) md(851)
|                  js(701) png(680) tbl(639) csv(549)
|      Conf files: package.json(149) settings.json(71) gulp.js(1)
|                  tsconfig.json(1) launch.json(1) tasks.json(1)
|      Launch Configs: java(13) node(4) chrome
|    Folder (XXX): 2968 files
|      File types: ibd(635) jar(219) dll(150) jmod(141) pak(112) sdi(105)
|                  md(84) exe(72) dylib(62) so(59)
|      Conf files: tsconfig.json(1) settings.json(1)

I have disabled the tslint plugin. @mjbvz