microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.29k stars 1.18k forks source link

hight cpu and vscode is stuck #24147

Open goasleep opened 4 hours ago

goasleep commented 4 hours ago

Type: Performance Issue

Behaviour

when debug python(3.12.5), the plugin is hight cpu and vscode is stuck.

Steps to reproduce:

  1. create test.py
  2. test.py like below
    from collections import Counter
    f = Counter([1,2,3])
  3. add breakpoint in the line self.update(iterable, **kwds) which below to Counter.__init__ function. In my code the line is python3.12/collections/__init__.py:607
  4. start debug on test.py the debug config is like below
    {
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": false
        }
    ]
    }
  5. when debug run the breakpoint line, seems the vscode is stuck and find code helper(plugin) get 100% cpu

Extension version: 2024.14.1 VS Code version: Code 1.93.1 (Universal) (38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40, 2024-09-11T17:20:05.685Z) OS version: Darwin arm64 23.6.0 Modes:

User Settings

``` languageServer: "Jedi" testing • pytestEnabled: true ```

Installed Extensions |Extension Name|Extension Id|Version| |---|---|---| |Code Cover|bradleymeck.codecover|1.1.0| |Codeium: AI Coding Autocomplete and Chat for Python, Javascript, Typescript, Java, Go, and more|Codeium.codeium|1.16.17| |JavaScript Debugger|ms-vscode.js-debug|1.93.0| |JavaScript Debugger Companion Extension|ms-vscode.js-debug-companion|1.1.3| |Jupyter|ms-toolsai.jupyter|2024.8.1| |Jupyter Cell Tags|ms-toolsai.vscode-jupyter-cell-tags|0.1.9| |Jupyter Keymap|ms-toolsai.jupyter-keymap|1.1.2| |Jupyter Notebook Renderers|ms-toolsai.jupyter-renderers|1.0.19| |Jupyter Slide Show|ms-toolsai.vscode-jupyter-slideshow|0.1.6| |Makefile Tools|ms-vscode.makefile-tools|0.11.13| |Markdown All in One|yzhang.markdown-all-in-one|3.6.2| |Python|ms-python.python|2024.14.1| |Table Visualizer for JavaScript Profiles|ms-vscode.vscode-js-profile-table|1.0.9|
System Info |Item|Value| |---|---| |CPUs|Apple M3 (8 x 2400)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|2, 4, 4| |Memory (System)|24.00GB (0.13GB free)| |Process Argv|--crash-reporter-id 47d9302d-61ce-4087-803d-6082d42f1836| |Screen Reader|no| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 10 246 71205 code main 0 98 71209 gpu-process 0 25 71210 utility-network-service 0 74 71227 ptyHost 0 0 43488 /bin/zsh -i 0 0 43503 /bin/zsh -i 0 0 43529 /bin/zsh -il 0 123 71229 shared-process ```
Workspace Info ``` | Window (Extension: Python — demo) | Folder (demo): more than 22288 files | File types: py(8247) pyc(2742) pyi(1897) json(1464) gz(854) txt(131) | h(111) typed(109) so(80) proto(67) | Conf files: cmake(34) dockerfile(2) | Launch Configs: debugpy; ```
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 2e7ec940:31000449 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 01bff139:31013167 a69g1124:31058053 dvdeprecation:31068756 dwnewjupyter:31046869 newcmakeconfigv2:31071590 impr_priority:31102340 nativerepl2:31139839 refactort:31108082 pythonrstrctxt:31112756 flightc:31134773 wkspc-onlycs-t:31132770 wkspc-ranged-t:31125599 ei213698:31121563 notype1:31143045 5fd0e150:31140164 ```
goasleep commented 4 hours ago

When I try to use start extension bisect and try to report it but the issue reporter cannot click the preview on github so the process info and A/B Experiments are for reference only