microsoft / vscode

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

Opening nodejs project in VS Code creates node zombie processes #160407

Closed davidwincent closed 2 years ago

davidwincent commented 2 years ago

Type: Performance Issue

$ yarn create next-app --typescript node-zombie $ cd node-zombie $ code .

Wait a few hours, usually the problem happens in the end of the day.

When filing this report I have:

I have 2 node-processes consuming 100% cpu each,

This is the information shown in Activity Monitor:

node (PID: 69053)

cwd
/Users/david/****/*****
txt
/Users/david/.nvm/versions/node/v16.17.0/bin/node
txt
/usr/lib/dyld
0
->(none)
1
->(none)
2
->(none)
3
count=0, state=0
4
->0xb636d26fa67b8c8a
5
->0x82c07915c62c67bd
6
->0xfee8ccbf80f3e48f
7
->0x3e4d1465c8ca9447
8
->0xae5fa0d313bf9e61
9
->0xa4cafdceed509d0c
10
count=0, state=0xa
11
->0xb56fb30abe09b11c
12
->0xf4dbef87cbd1da02
13
->0x4a301880de2ce9d9
14
->0xe87eeaac7382526a
15
count=1, state=0x8
16
->0x3d223fffbac5298a
17
->0xeda46a054229300f
18
->0x73207ade3d10149
19
->0xa481dac0a0105635
20
/dev/null
25
/Users/david/Library/Application Support/Code/logs/20220906T141523/ptyhost.log
27
/Applications/Visual Studio Code.app/Contents/Resources/app/node_modules.asar
28
/dev/ptmx
29
/dev/ptmx

node (PID: 76086)

cwd
/Users/david/****/*****
txt
/Users/david/.nvm/versions/node/v16.17.0/bin/node
txt
/usr/lib/dyld
0
->(none)
1
->(none)
2
->(none)
3
count=0, state=0
4
->0x2dd6271dc1c8e2e5
5
->0x20da1f97b861c1e4
6
->0x4e756397d8a2af6e
7
->0x207ed7135dee2a0b
8
->0xeb00a81eee1b9c9a
9
->0xc8a26f8fb6b0f035
10
count=0, state=0xa
11
->0x91bf2ebe086b3819
12
->0x579bf5bbbe7f0743
13
->0x24966e8e8cc77a22
14
->0x284d6c3c268b3f76
15
count=1, state=0x8
16
->0x9ede50a5588cbf65
17
->0xacb5843d541592ab
18
->0xd6107b962c568745
19
->0x2196f586c387be8d
20
/dev/null
25
/Users/david/Library/Application Support/Code/logs/20220906T141523/ptyhost.log
27
/Applications/Visual Studio Code.app/Contents/Resources/app/node_modules.asar
28
/dev/ptmx
29
/dev/ptmx
30
/dev/ptmx
31
/dev/ptmx

VS Code version: Code 1.71.0 (784b0177c56c607789f9638da7b6bf3230d47a8c, 2022-09-01T07:25:25.516Z) OS version: Darwin arm64 21.6.0 Modes: Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|Apple M1 Pro (10 x 24)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|4, 5, 4| |Memory (System)|16.00GB (0.10GB free)| |Process Argv|. --crash-reporter-id 34771417-56e9-4eff-a2c1-aed91c8d4b78| |Screen Reader|no| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 17 147 2298 code main 0 66 2301 gpu-process 0 16 2302 utility-network-service 2 131 2309 shared-process 0 16 2311 ptyHost 0 16 55347 fileWatcher 0 33 56636 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Renderer).app/Contents/MacOS/Code Helper (Renderer) --ms-enable-electron-run-as-node /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork ms-vscode.pwa-chrome {"common.vscodemachineid":"604978e9bd04ca76ad8dbdbe2eef848fac1ba6d4bd5776d8af71ebd7d9ca2f3c","common.vscodesessionid":"f6d119b3-be2e-42dc-abc3-e1bc94d43dee1662466524829"} AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217 0 0 78902 /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 1 442 41096 window (web-order) 0 164 55300 extensionHost 0 16 55327 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/david/.vscode/extensions/redhat.vscode-yaml-1.10.1/dist/languageserver.js --node-ipc --clientProcessId=55300 0 16 55385 node /Users/david/.nvm/versions/node/v16.17.0/bin/yarn jest --runInBand --testLocationInResults --json --useStderr --outputFile /var/folders/ll/_n1f627d7nl61d0nwtff9gnc0000gn/T/jest_runner_web_order.json --watch --no-coverage --reporters default --reporters /Users/david/.vscode/extensions/orta.vscode-jest-4.6.0/out/reporter.js --colors 0 16 55386 /Users/david/.nvm/versions/node/v16.17.0/bin/node /Users/david/yabie/web-order/node_modules/.bin/jest --runInBand --testLocationInResults --json --useStderr --outputFile /var/folders/ll/_n1f627d7nl61d0nwtff9gnc0000gn/T/jest_runner_web_order.json --watch --no-coverage --reporters default --reporters /Users/david/.vscode/extensions/orta.vscode-jest-4.6.0/out/reporter.js --colors 0 16 55631 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/david/.vscode/extensions/dbaeumer.vscode-eslint-2.2.6/server/out/eslintServer.js --node-ipc --clientProcessId=55300 0 16 55638 /Users/david/.vscode/extensions/sonarsource.sonarlint-vscode-3.9.0-darwin-arm64/jre/17.0.4-macosx-aarch64.tar/bin/java -jar /Users/david/.vscode/extensions/sonarsource.sonarlint-vscode-3.9.0-darwin-arm64/server/sonarlint-ls.jar 50186 -analyzers /Users/david/.vscode/extensions/sonarsource.sonarlint-vscode-3.9.0-darwin-arm64/analyzers/sonarjava.jar /Users/david/.vscode/extensions/sonarsource.sonarlint-vscode-3.9.0-darwin-arm64/analyzers/sonarjs.jar /Users/david/.vscode/extensions/sonarsource.sonarlint-vscode-3.9.0-darwin-arm64/analyzers/sonarphp.jar /Users/david/.vscode/extensions/sonarsource.sonarlint-vscode-3.9.0-darwin-arm64/analyzers/sonarpython.jar /Users/david/.vscode/extensions/sonarsource.sonarlint-vscode-3.9.0-darwin-arm64/analyzers/sonarhtml.jar /Users/david/.vscode/extensions/sonarsource.sonarlint-vscode-3.9.0-darwin-arm64/analyzers/sonarxml.jar /Users/david/.vscode/extensions/sonarsource.sonarlint-vscode-3.9.0-darwin-arm64/analyzers/sonarcfamily.jar -extraAnalyzers /Users/david/.vscode/extensions/sonarsource.sonarlint-vscode-3.9.0-darwin-arm64/analyzers/sonarsecrets.jar 0 16 55639 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/david/.vscode/extensions/ms-python.vscode-pylance-2022.8.50/dist/server.bundle.js --cancellationReceive=file:8ae6e49a1772fd5ed6d51eadbbf46dc271eef0f537 --node-ipc --clientProcessId=55300 0 16 55791 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=55300 0 16 55893 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node --max-old-space-size=3072 /Users/david/.vscode/extensions/ms-vscode.vscode-typescript-next-4.9.20220905/node_modules/typescript/lib/tsserver.js --serverMode partialSemantic --useInferredProjectPerProjectRoot --disableAutomaticTypingAcquisition --cancellationPipeName /var/folders/ll/_n1f627d7nl61d0nwtff9gnc0000gn/T/vscode-typescript501/c3895724df077298d24f/tscancellation-bc3b49fc6e42299cdea5.tmp* --globalPlugins @vsintellicode/typescript-intellicode-plugin,ms-vsintellicode-typescript --pluginProbeLocations /Users/david/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.24,/Users/david/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.24 --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc 0 33 55894 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node --max-old-space-size=3072 /Users/david/.vscode/extensions/ms-vscode.vscode-typescript-next-4.9.20220905/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /var/folders/ll/_n1f627d7nl61d0nwtff9gnc0000gn/T/vscode-typescript501/c3895724df077298d24f/tscancellation-1867f7d07d81c78c98c8.tmp* --globalPlugins @vsintellicode/typescript-intellicode-plugin,ms-vsintellicode-typescript --pluginProbeLocations /Users/david/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.24,/Users/david/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.24 --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc 0 16 55906 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/david/.vscode/extensions/ms-vscode.vscode-typescript-next-4.9.20220905/node_modules/typescript/lib/typingsInstaller.js --globalTypingsCacheLocation /Users/david/Library/Caches/typescript/4.9 --enableTelemetry --typesMapLocation /Users/david/.vscode/extensions/ms-vscode.vscode-typescript-next-4.9.20220905/node_modules/typescript/lib/typesMap.json --validateDefaultNpmLocation 0 98 56635 electron_node ms-vscode.js 0 66 56647 gpu-process 0 33 56651 utility-network-service 0 16 56656 utility 0 16 57180 window (undefined) 0 49 57212 window (undefined) 0 49 57215 window (undefined) 0 16 57228 window (undefined) 0 33 57229 window (undefined) 0 66 57308 window (undefined) 0 82 57341 window (undefined) 0 82 57342 window (undefined) 0 16 57552 window (undefined) 0 49 58119 window (undefined) 0 49 68934 window (undefined) 0 33 68945 window (undefined) 0 82 68946 window (undefined) 0 16 68953 utility 0 33 68962 window (undefined) 0 49 69823 window (undefined) 0 82 76540 process-explorer 0 279 77512 window (undefined) 3 98 78875 issue-reporter ```
Workspace Info ``` | Window (web-order) | Folder (web-order): 2076 files | File types: js(124) ts(46) tsx(41) json(19) pack(18) png(17) jsx(5) | gitignore(3) sh(3) css(3) | Conf files: package.json(2) launch.json(1) settings.json(1) | dockerfile(1) tsconfig.json(1) | Launch Configs: pwa-chrome node; ```

Extensions: none

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411cf:30557515
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vscaac:30438847
pylanb8912:30545647
vsclangdc:30486549
c4g48928:30535728
hb751961:30553087
dsvsc012:30540252
azure-dev_surveyone:30548225
i497e931:30553904

mjbvz commented 2 years ago

@Tyriar Based on ptyhost.log, could these be terminal processes?

meganrogge commented 2 years ago

to be clear, are your first two steps taken in an integrated terminal within VS Code?

davidwincent commented 2 years ago

to be clear, are your first two steps taken in an integrated terminal within VS Code?

No, the third steps open vs code

davidwincent commented 2 years ago

One theory is that kill terminal in vs code (trash bin icon or command-backspace) does not send any signal to terminate the terminal processes?

I am using the builtin JavaScript debugger to launch npm script with local development server. Stopping the server with ctrl-c instead if kill terminal seems to work better.

meganrogge commented 2 years ago

I looked into the code and seems like we do the right thing here.

I also looked at the process explorer and killing the process via ctrl+c or the trash button have the same effect.

could you make a gif of the process explorer next to the vs code window when this happens?

vscodenpa commented 2 years ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

davidwincent commented 2 years ago

Not sure if coincidence, the problem seems to be removed after I started using ctrl+c instead if kill terminal.

I am using Concurrently in my dev script, maybe this package has some sigterm/cleanup issues?