microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.76k stars 29.47k forks source link

automatically exit of out of memory #119837

Closed rookiefiend closed 2 years ago

rookiefiend commented 3 years ago

Steps to Reproduce:

  1. start vscode, wait some time.
  2. vscode will automatically exit of out of memory

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

I think this is related for my os or electron, becase my other software(such as: typora) also have this question, but I don't know why happen this. Please help.
The lastest log with code --verbose is:

[5843:0325/091047.084253:INFO:CONSOLE(25)] "%cTRACE color: #888 ExtensionManagementService.refreshReportedCache", source: file:///opt/visual-studio-code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js (25)
[5843:0325/091047.084352:INFO:CONSOLE(25)] "%cTRACE color: #888 RequestService#request https://az764295.vo.msecnd.net/extensions/marketplace.json", source: file:///opt/visual-studio-code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js (25)
tcmalloc: large alloc 1868906496 bytes == 0x3390edac7000 @  0x55aa1d3d839e 0x55aa1f4723fc 0x55aa1dd4c942 0x55aa1dd4d50e 0x55aa1f4309ce 0x55aa1f447667 0x55aa1f447172 0x55aa1f47d568 0x55aa1f446cbe 0x55aa1f453874 0x55aa1f45357d 0x55aa1f47dcf1 0x7fcacef6a299
[5843:0325/091118.507523:INFO:CONSOLE(25)] "%cTRACE color: #888 ExtensionManagementService.refreshReportedCache - failed to get extension report", source: file:///opt/visual-studio-code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js (25)
[5843:0325/091118.508608:INFO:CONSOLE(25)] "%cTRACE color: #888 Started scanning user extensions", source: file:///opt/visual-studio-code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js (25)
[5843:0325/091118.527121:INFO:CONSOLE(25)] "%cTRACE color: #888 Error: ENOENT: no such file or directory, open '/home/syy/.vscode/extensions/tabnine.tabnine-vscode-3.2.10/package.json'", source: file:///opt/visual-studio-code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js (25)
[5843:0325/091118.547255:INFO:CONSOLE(25)] "%cTRACE color: #888 Scanned user extensions: 22", source: file:///opt/visual-studio-code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js (25)
[5843:0325/091126.716215:INFO:CONSOLE(626)] "%cTRACE color: #888 [text file model] load() - enter file:///home/syy/PersonalData/code/go/src/demos/main.go", source: file:///opt/visual-studio-code/resources/app/out/vs/workbench/workbench.desktop.main.js (626)
[5843:0325/091126.716300:INFO:CONSOLE(626)] "%cTRACE color: #888 [text file model] loadFromFile() file:///home/syy/PersonalData/code/go/src/demos/main.go", source: file:///opt/visual-studio-code/resources/app/out/vs/workbench/workbench.desktop.main.js (626)
[main 2021-03-25T01:11:26.927Z] menubarService#updateMenubar 1
[5843:0325/091126.972584:INFO:CONSOLE(626)] "%cTRACE color: #888 CommandService#executeCommand _executeDocumentSymbolProvider", source: file:///opt/visual-studio-code/resources/app/out/vs/workbench/workbench.desktop.main.js (626)
[5843:0325/091128.714032:INFO:CONSOLE(25)] "%cTRACE color: #888 RequestService#request https://vscode-sync.trafficmanager.net/v1/manifest", source: file:///opt/visual-studio-code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js (25)
[5843:0325/091129.411925:INFO:CONSOLE(25)] "%cTRACE color: #888 Started scanning system extensions", source: file:///opt/visual-studio-code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js (25)
[5843:0325/091129.412491:INFO:CONSOLE(25)] "%cTRACE color: #888 Started scanning user extensions", source: file:///opt/visual-studio-code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js (25)
[5843:0325/091129.426001:INFO:CONSOLE(25)] "%cTRACE color: #888 Error: ENOENT: no such file or directory, open '/home/syy/.vscode/extensions/tabnine.tabnine-vscode-3.2.10/package.json'", source: file:///opt/visual-studio-code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js (25)
[5843:0325/091129.438201:INFO:CONSOLE(25)] "%cTRACE color: #888 Scanned user extensions: 22", source: file:///opt/visual-studio-code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js (25)
[5843:0325/091129.440989:INFO:CONSOLE(25)] "%cTRACE color: #888 Error: ENOENT: no such file or directory, open '/opt/visual-studio-code/resources/app/extensions/node_modules/package.json'", source: file:///opt/visual-studio-code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js (25)
[5843:0325/091129.458390:INFO:CONSOLE(25)] "%cTRACE color: #888 Scanned system extensions: 85", source: file:///opt/visual-studio-code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js (25)
[main 2021-03-25T01:11:29.731Z] menubarService#updateMenubar 1
[5843:0325/091219.819941:FATAL:memory_linux.cc(37)] Out of memory.
/dev/fd/3: 没有那个文件或目录
Server response:
/dev/fd/3: 没有那个文件或目录
Server response:
vscodebot[bot] commented 3 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

rookiefiend commented 3 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

I think it's not duplicate. I is exit because out of memory and vsocde can normally running a period of time.

Tyriar commented 3 years ago

Are you actually out of memory? Do you suspect a memory leak?

deepak1556 commented 3 years ago

Can you follow these steps https://github.com/microsoft/vscode/wiki/Native-Crash-Issues#creating-and-symbolicating-local-crash-reports and attach the crash logs.

Also what is the output of cat /proc/meminfo

rookiefiend commented 3 years ago

Are you actually out of memory? Do you suspect a memory leak?

yes,i suspect is a memory leak, beacuse my host config is: image

rookiefiend commented 3 years ago

Can you follow these steps https://github.com/microsoft/vscode/wiki/Native-Crash-Issues#creating-and-symbolicating-local-crash-reports and attach the crash logs.

Also what is the output of cat /proc/meminfo

this is /proc/memory after crash:

$ cat /proc/meminfo 
MemTotal:       15807140 kB
MemFree:        12573792 kB
MemAvailable:   12979956 kB
Buffers:           25476 kB
Cached:           954964 kB
SwapCached:            0 kB
Active:           205672 kB
Inactive:        2343588 kB
Active(anon):      16608 kB
Inactive(anon):  1901236 kB
Active(file):     189064 kB
Inactive(file):   442352 kB
Unevictable:          48 kB
Mlocked:              48 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:               136 kB
Writeback:             0 kB
AnonPages:       1568940 kB
Mapped:           558048 kB
Shmem:            353464 kB
KReclaimable:      50540 kB
Slab:             150168 kB
SReclaimable:      50540 kB
SUnreclaim:        99628 kB
KernelStack:       14736 kB
PageTables:        36704 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     7903568 kB
Committed_AS:    9704724 kB
VmallocTotal:   34359738367 kB
VmallocUsed:       49444 kB
VmallocChunk:          0 kB
Percpu:            11072 kB
HardwareCorrupted:     0 kB
AnonHugePages:      2048 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:      790464 kB
DirectMap2M:    13230080 kB
DirectMap1G:     3145728 kB

this is /proc/memory when code running

$ cat /proc/meminfo 
MemTotal:       15807140 kB
MemFree:         2869904 kB
MemAvailable:    4293464 kB
Buffers:           54860 kB
Cached:          1977704 kB
SwapCached:            0 kB
Active:           355192 kB
Inactive:       11734972 kB
Active(anon):      25280 kB
Inactive(anon): 10425256 kB
Active(file):     329912 kB
Inactive(file):  1309716 kB
Unevictable:          64 kB
Mlocked:              64 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:            401116 kB
Writeback:           156 kB
AnonPages:      10057800 kB
Mapped:           799752 kB
Shmem:            395632 kB
KReclaimable:      68912 kB
Slab:             173052 kB
SReclaimable:      68912 kB
SUnreclaim:       104140 kB
KernelStack:       18160 kB
PageTables:        63004 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     7903568 kB
Committed_AS:   21531716 kB
VmallocTotal:   34359738367 kB
VmallocUsed:       53240 kB
VmallocChunk:          0 kB
Percpu:            11072 kB
HardwareCorrupted:     0 kB
AnonHugePages:      2048 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:      821184 kB
DirectMap2M:    13199360 kB
DirectMap1G:     3145728 kB

this is crash dir content: vscode-crash.zip

this is top command when vscode running, I don't if it is normal.

# this is code just start
$ top -c -n 1

top - 09:13:27 up 42 min,  1 user,  load average: 1.83, 1.17, 1.10
任务: 289 total,   1 running, 288 sleeping,   0 stopped,   0 zombie
%Cpu(s): 14.7 us, 13.7 sy,  0.0 ni, 71.6 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  15436.7 total,  11208.8 free,   2858.6 used,   1369.3 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.  11917.6 avail Mem 

 进程号 USER      PR  NI    VIRT    RES    SHR    %CPU  %MEM     TIME+ COMMAND                                                                                                                                                                
   6870           20   0 4987676 315700 102604 S 100.0   2.0   0:10.22 /opt/visual-studio-code/code --no-sandbox --unity-launch                                                                                                               
   3468           20   0   36.5g 137940  41012 S  12.5   0.9   2:21.58 /opt/google/chrome-unstable/chrome --type=renderer --field-trial-handle=12554150912777368204,1049160295444478812,131072 --lang=zh-CN --origin-trial-disabled-features+ 

# this is code run for a while
$ top -c -n 1

top - 09:16:15 up 45 min,  1 user,  load average: 1.70, 1.40, 1.20
任务: 284 total,   1 running, 283 sleeping,   0 stopped,   0 zombie
%Cpu(s):  7.1 us, 15.2 sy,  0.0 ni, 75.8 id,  1.0 wa,  1.0 hi,  0.0 si,  0.0 st
MiB Mem :  15436.7 total,   8197.3 free,   5857.0 used,   1382.4 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.   8922.1 avail Mem 

 进程号 USER      PR  NI    VIRT    RES    SHR    %CPU  %MEM     TIME+ COMMAND                                                                                                                                                                
   6870           20   0 9454464   3.3g 102776 S  93.8  21.9   2:53.91 /opt/visual-studio-code/code --no-sandbox --unity-launch                                                                                                               
   3468           20   0   36.5g 140864  41012 S  12.5   0.9   2:35.35 /opt/google/chrome-unstable/chrome --type=renderer --field-trial-handle=12554150912777368204,1049160295444478812,131072 --lang=zh-CN --origin-trial-disabled-features+ 

as you can see, memory usage is growing all the time

rookiefiend commented 3 years ago

Just in case,I disable all extensions try again, and I found the memory usage also is growing all the time.


$ code --disable-extensions .
$ top -c -n 1 

top - 09:30:04 up 58 min,  1 user,  load average: 2.32, 2.03, 1.67
任务: 284 total,   1 running, 283 sleeping,   0 stopped,   0 zombie
%Cpu(s):  8.0 us, 15.0 sy,  0.0 ni, 77.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  15436.7 total,   9387.1 free,   4595.7 used,   1453.8 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.  10156.9 avail Mem 

 进程号 USER      PR  NI    VIRT    RES    SHR    %CPU  %MEM     TIME+ COMMAND                                                                                                                                                                
   8747           20   0 7171804   2.0g 102272 S  93.8  13.2   1:41.19 /opt/visual-studio-code/code --disable-extensions --no-sandbox .

$ top -c -n 1 

top - 09:30:51 up 59 min,  1 user,  load average: 1.81, 1.93, 1.65
任务: 284 total,   1 running, 283 sleeping,   0 stopped,   0 zombie
%Cpu(s):  9.5 us, 14.7 sy,  0.0 ni, 73.7 id,  0.0 wa,  1.1 hi,  1.1 si,  0.0 st
MiB Mem :  15436.7 total,   8522.1 free,   5461.0 used,   1453.6 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.   9291.5 avail Mem 

 进程号 USER      PR  NI    VIRT    RES    SHR    %CPU  %MEM     TIME+ COMMAND                                                                                                                                                                
   8747           20   0 8520488   2.8g 102272 S  87.5  18.7   2:26.13 /opt/visual-studio-code/code --disable-extensions --no-sandbox .
rookiefiend commented 3 years ago

Is there anyone who can help me? and Is need other information? If this problem is not easy to solve, I will try to restore my system. Thanks. 🥺

rookiefiend commented 2 years ago

when the latest version, I don't meet this question, I will close this issue.