microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.31k stars 12.53k forks source link

OS getting unresponsive when JSDoc importing `"/dev/random"`, forcing manual restart #59740

Closed nnmrts closed 2 months ago

nnmrts commented 3 months ago

Type: Bug

  1. Create a file called "test.js"
  2. Add this to it:
    /**
    * @import random from "/dev/random";
    */

VS Code version: Code - Insiders 1.93.0-insider (e1db90f81da28c0994b5d50dc2b51e964359e62d, 2024-08-21T05:04:11.586Z) OS version: Darwin arm64 24.0.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M2 (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)|4, 27, 23| |Memory (System)|8.00GB (0.10GB free)| |Process Argv|. --crash-reporter-id 947da815-1330-4250-b5d4-0d11d1584721| |Screen Reader|no| |VM|0%|
Extensions (103) Extension|Author (truncated)|Version ---|---|--- commit-message-editor|ada|0.25.0 vscode-sqlite|ale|0.14.1 codewhisperer-for-command-line-companion|ama|1.3.3 vscode-color|ans|0.4.5 astro-vscode|ast|2.14.1 atlascode|atl|3.0.10 github-markdown-preview|bie|0.3.0 markdown-checkbox|bie|0.4.0 markdown-emoji|bie|0.3.0 markdown-footnotes|bie|0.1.1 markdown-mermaid|bie|1.23.1 markdown-preview-github-styles|bie|2.0.4 markdown-yaml-preamble|bie|0.1.0 vscode-tailwindcss|bra|0.12.7 gltf-vscode|ces|2.5.0 postcss|css|1.0.9 markdown-table-prettify|dar|3.6.0 vscode-markdownlint|Dav|0.55.0 vscode-eslint|dba|3.0.10 vscode-ast|ddo|0.0.3 vscode-dash|dee|2.4.0 vscode-deno|den|3.38.2 vscode-wavefront|dmn|1.0.1 vscode-wasm|dts|1.4.1 vs-code-xml-format|fab|0.1.5 vscode-diff|fab|2.1.2 vscode-markdown-todo|fab|2.0.0 markmap-vscode|ger|0.1.4 copilot|Git|1.223.0 copilot-chat|Git|0.20.2024082201 remotehub|Git|0.62.0 vscode-github-actions|git|0.26.3 gitlab-workflow|Git|5.8.0 todo-tree|Gru|0.0.226 vscode-test-explorer|hbe|2.21.1 latex-workshop|Jam|10.1.0 yaclock|jam|1.0.3 batch-rename-extension|Jan|0.0.6 svg|joc|1.5.4 i18n-ally|lok|2.12.0 lsp-wl-client|lsp|0.1.11 code-coverage|mar|1.12.0 rainbow-csv|mec|3.12.0 git-graph|mhu|1.30.0 dotenv|mik|1.0.1 better-git-line-blame|mk1|0.2.11 vscode-lebab|mrm|2.6.0 vscode-scss|mrm|0.10.0 vscode-language-pack-de|MS-|1.93.2024082109 vscode-dotnet-runtime|ms-|2.1.5 debugpy|ms-|2024.10.0 python|ms-|2024.12.3 vscode-pylance|ms-|2024.8.1 datawrangler|ms-|1.7.2 jupyter|ms-|2024.7.0 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.19 vscode-jupyter-cell-tags|ms-|0.1.9 vscode-jupyter-slideshow|ms-|0.1.6 remote-containers|ms-|0.382.0 remote-ssh|ms-|0.114.2024082315 remote-ssh-edit|ms-|0.86.0 remote-wsl|ms-|0.88.2 vscode-remote-extensionpack|ms-|0.25.0 azure-repos|ms-|0.38.0 cmake-tools|ms-|1.18.44 cpptools|ms-|1.21.6 cpptools-extension-pack|ms-|1.3.0 live-server|ms-|0.4.14 remote-explorer|ms-|0.4.3 remote-repositories|ms-|0.40.0 remote-server|ms-|1.5.2 test-adapter-converter|ms-|0.1.9 vscode-typescript-next|ms-|5.7.20240823 color-highlight|nau|2.8.0 ast-query|nik|0.1.5 htmx-tags|oto|0.0.8 material-icon-theme|PKi|5.9.0 polacode|pnp|0.3.4 quicktype|qui|23.0.170 geo-data-viewer|Ran|2.6.0 vscode-xml|red|0.27.2024071808 vscode-yaml|red|1.15.0 vscode-paste-and-indent|Rub|0.0.8 vscode-wl|shi|1.7.3 file-tree-generator|Shi|1.1.1 vscode-scss-formatter|sib|3.0.0 tauri-vscode|tau|0.2.6 cwtools-vscode|tbo|0.10.25 paradox-syntax|tbo|0.1.17 markdown-links|tch|0.8.0 graphviz-interactive-preview|tin|0.3.5 cmake|twx|0.0.17 vscode-mdx|uni|1.8.10 errorlens|use|3.20.0 es-quotes|vil|0.2.6 highlight-matching-tag|vin|0.11.0 vscodeintellicode|Vis|1.3.1 vscode-conventional-commits|viv|1.25.0 vscode-nginx|wil|0.7.2 change-case|wma|1.0.0 pretty-ts-errors|Yoa|0.6.0 material-theme|zhu|3.17.2 (1 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805cf:30301675 vsaa593:30376534 py29gd2263:31024238 c4g48928:30535728 962ge761:30841072 pythongtdpath:30726887 welcomedialog:30812478 pythonnoceb:30776497 asynctok:30898717 dsvsc014:30777825 dsvsc015:30821418 pythonregdiag2:30926734 pythonmypyd1:30859725 h48ei257:31000450 pythontbext0:30879054 accentitlementst:30870582 dsvsc016:30879898 dsvsc017:30880771 dsvsc018:30880772 cppperfnew:30980852 pythonait:30973460 f3je6385:31013174 a69g1124:31018687 dvdeprecation:31040973 dwnewjupyter:31046869 impr_priority:31057980 nativerepl1:31104042 refactort:31084545 pythonrstrctxt:31093868 flighttreat:31119334 wkspc-onlycs-t:31111718 nativeloc1:31118317 3ad50483:31111987 fcdif617:31111928 e80f6927:31120813 fje88620:31121564 i21gd607:31121876 ```
sandersn commented 2 months ago

Doesn't repro on linux/x64. I'll try on darwin/arm64 next.

sandersn commented 2 months ago

It doesn't repro on darwin/arm64 either. Admittedly I have an M1 with 16 GB of memory. Does it reproduce if you shut off all the other extensions?

Edit: Tried on both 1.92 and 1.93-insider, on mac.

nnmrts commented 2 months ago

Interesting, might be the deno extension. Now that I actually have time to purposely crash my machine repeatedly, I'll try it out. See you on the other side. ;)

nnmrts commented 2 months ago

Yep, it's the deno extension or rather just deno. New minimal repro:

  1. Install the deno extension.
  2. Create .vscode/settings.json
    {
        "deno.enable": true
    }
  3. Create test.js

    /**
     * @import random from "/dev/random";
     */
    
    /**
     * @typedef {`${random}`} Test
     */
  4. Now hover over Test and watch your CPU and memory melting until everything freezes and/or crashes.

I reported this at https://github.com/denoland/vscode_deno/issues/1158.