microsoft / vscode

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

Terminal locks up when using bash history #224144

Closed jasonpolites closed 2 months ago

jasonpolites commented 2 months ago

Type: Bug

Using WSL (Ubuntu 20.04.6 LTS), running a bash shell in a Terminal window.

If I attempt to use the bash history (Control+R on Windows), then select an item with the Tab key, the terminal locks up and can't be recovered.

VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:06:49.809Z) OS version: Windows_NT x64 10.0.19045 Modes: Remote OS version: Linux x64 5.15.90.1-microsoft-standard-WSL2

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 x 4008)| |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
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.95GB (8.70GB free)| |Process Argv|--crash-reporter-id 8085dd57-4c15-4b70-965d-31f6d25f8c39| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu-20.04| |OS|Linux x64 5.15.90.1-microsoft-standard-WSL2| |CPUs|Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 x 0)| |Memory (System)|15.60GB (12.67GB free)| |VM|0%|
Extensions (10) Extension|Author (truncated)|Version ---|---|--- eml|lei|0.4.0 remote-containers|ms-|0.375.1 remote-ssh|ms-|0.112.0 remote-ssh-edit|ms-|0.86.0 remote-wsl|ms-|0.88.2 remote-explorer|ms-|0.4.3 vscode-github-actions|git|0.26.3 vscode-docker|ms-|1.29.1 test-adapter-converter|ms-|0.1.9 postman-for-vscode|Pos|1.1.0
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscoreces:30445986 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 2e7ec940:31000449 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 jg8ic977:31013176 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 impr_priority:31094925 ccplc:31098109 pythonrstrctxtcf:31093870 ```
meganrogge commented 2 months ago

can you run this command, repro, and share the output?

Image

jasonpolites commented 2 months ago

Output below. It reproduced reliably, although nothing in the log seems unxpected. The sequence starts from Resolving ctrl+R. I then typed "npm". You can see that in the log. I'm not sure why there are lots of duplicates, I definitely didn't double-tap keys. Probably just a logging issue. The reference to Resolving Tab is where it locks up. The subsequent down/up arrow reports is me confirming that the terminal is unresponsive (which it was)

2024-07-29 09:54:05.278 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:05.278 [info] [KeybindingService]: \ Keyboard event cannot be dispatched
2024-07-29 09:54:05.278 [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 17, key: Control
2024-07-29 09:54:05.278 [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 5 ('Ctrl')
2024-07-29 09:54:05.279 [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
2024-07-29 09:54:05.438 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:05.438 [info] [KeybindingService]: | Resolving ctrl+R
2024-07-29 09:54:05.438 [info] [KeybindingService]: \ From 4 keybinding entries, matched workbench.action.openRecent, when: no when condition, source: built-in.
2024-07-29 09:54:05.510 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:05.510 [info] [KeybindingService]: | Resolving ctrl+R
2024-07-29 09:54:05.510 [info] [KeybindingService]: \ From 4 keybinding entries, matched workbench.action.openRecent, when: no when condition, source: built-in.
2024-07-29 09:54:05.757 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:05.758 [info] [KeybindingService]: \ Keyboard event cannot be dispatched
2024-07-29 09:54:05.758 [info] [KeybindingService]: + Ignoring single modifier ctrl due to it being pressed together with other keys.
2024-07-29 09:54:06.478 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:06.478 [info] [KeybindingService]: | Resolving N
2024-07-29 09:54:06.478 [info] [KeybindingService]: \ No keybinding entries.
2024-07-29 09:54:06.606 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:06.606 [info] [KeybindingService]: | Resolving N
2024-07-29 09:54:06.606 [info] [KeybindingService]: \ No keybinding entries.
2024-07-29 09:54:06.606 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:06.607 [info] [KeybindingService]: | Resolving P
2024-07-29 09:54:06.607 [info] [KeybindingService]: \ No keybinding entries.
2024-07-29 09:54:06.693 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:06.694 [info] [KeybindingService]: | Resolving P
2024-07-29 09:54:06.694 [info] [KeybindingService]: \ No keybinding entries.
2024-07-29 09:54:06.773 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:06.774 [info] [KeybindingService]: | Resolving M
2024-07-29 09:54:06.774 [info] [KeybindingService]: \ From 1 keybinding entries, no when clauses matched the context.
2024-07-29 09:54:06.861 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:06.862 [info] [KeybindingService]: | Resolving M
2024-07-29 09:54:06.862 [info] [KeybindingService]: \ From 1 keybinding entries, no when clauses matched the context.
2024-07-29 09:54:07.869 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:07.870 [info] [KeybindingService]: | Resolving Tab
2024-07-29 09:54:07.870 [info] [KeybindingService]: \ From 10 keybinding entries, no when clauses matched the context.
2024-07-29 09:54:07.966 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:07.966 [info] [KeybindingService]: | Resolving Tab
2024-07-29 09:54:07.966 [info] [KeybindingService]: \ From 10 keybinding entries, no when clauses matched the context.
2024-07-29 09:54:09.502 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:09.502 [info] [KeybindingService]: | Resolving DownArrow
2024-07-29 09:54:09.502 [info] [KeybindingService]: \ From 27 keybinding entries, no when clauses matched the context.
2024-07-29 09:54:09.614 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:09.614 [info] [KeybindingService]: | Resolving DownArrow
2024-07-29 09:54:09.614 [info] [KeybindingService]: \ From 27 keybinding entries, no when clauses matched the context.
2024-07-29 09:54:09.686 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:09.686 [info] [KeybindingService]: | Resolving DownArrow
2024-07-29 09:54:09.686 [info] [KeybindingService]: \ From 27 keybinding entries, no when clauses matched the context.
2024-07-29 09:54:09.749 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:09.750 [info] [KeybindingService]: | Resolving DownArrow
2024-07-29 09:54:09.750 [info] [KeybindingService]: \ From 27 keybinding entries, no when clauses matched the context.
2024-07-29 09:54:09.877 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:09.878 [info] [KeybindingService]: | Resolving UpArrow
2024-07-29 09:54:09.878 [info] [KeybindingService]: \ From 24 keybinding entries, no when clauses matched the context.
2024-07-29 09:54:09.918 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:09.918 [info] [KeybindingService]: | Resolving UpArrow
2024-07-29 09:54:09.918 [info] [KeybindingService]: \ From 24 keybinding entries, no when clauses matched the context.
2024-07-29 09:54:10.014 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:10.014 [info] [KeybindingService]: | Resolving UpArrow
2024-07-29 09:54:10.014 [info] [KeybindingService]: \ From 24 keybinding entries, no when clauses matched the context.
2024-07-29 09:54:10.085 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-07-29 09:54:10.086 [info] [KeybindingService]: | Resolving UpArrow
2024-07-29 09:54:10.086 [info] [KeybindingService]: \ From 24 keybinding entries, no when clauses matched the context.
Tyriar commented 2 months ago

Looks like ctrl+r is opening recent, not being sent to the shell:

2024-07-29 09:54:05.438 [info] [KeybindingService]: | Resolving ctrl+R
2024-07-29 09:54:05.438 [info] [KeybindingService]: \ From 4 keybinding entries, matched workbench.action.openRecent, when: no when condition, source: built-in.
2024-07-29 09:54:05.510 [info] [KeybindingService]: / Soft dispatching keyboard event

Can you share your settings.json and keybindings.json files?

jasonpolites commented 2 months ago

Hi folks. Sorry.. I was traveling.

So.. weirdly, I can't repro now. There was an update to vscode (to 1.92.0). Unclear if that's related. Sharing settings.json & keybindings.json anyway, but you can probably close this. If I can't repro, I can't complain :)

settings.json

{
    "typescript.tsserver.log": "normal",
    "editor.tabSize": 2,
    "files.eol": "\n",
    "terminal.integrated.rendererType": "dom",
    "workbench.colorTheme": "Visual Studio Dark",
    "editor.fontSize": 15,
    "editor.fontFamily": "Consolas, 'Courier New', monospace, 'Segoe UI Emoji'",
    "editor.renderWhitespace": "all",
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "C_Cpp.updateChannel": "Insiders",
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "redhat.telemetry.enabled": false,
    "terminal.integrated.defaultProfile.windows": "Ubuntu-20.04 (WSL)",
    "terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "Git Bash": {
            "source": "Git Bash"
        },
        "C:\\WINDOWS\\System32\\wsl.exe (migrated)": {
            "path": "C:\\WINDOWS\\System32\\wsl.exe",
            "args": []
        },
        "Ubuntu-20.04 (WSL)": {
            "path": "C:\\WINDOWS\\System32\\wsl.exe",
            "args": [
                "-d",
                "Ubuntu-20.04"
            ]
        }
    },
    "workbench.startupEditor": "none",
    "explorer.confirmDelete": false,
    "javascript.preferences.importModuleSpecifierEnding": "js",
    "editor.rulers": [
        120
    ],
    "security.allowedUNCHosts": [
        "wsl$"
    ],
    "javascript.updateImportsOnFileMove.enabled": "always",
    "editor.codeActionsOnSave": {
        // "source.organizeImports": "explicit",
        "source.addMissingImports": "explicit"
    },
    "editor.stickyScroll.enabled": false,
    "terminal.integrated.enableMultiLinePasteWarning": false,
    "files.associations": {
        "*.template": "html"
    },
}

keybindings.json

// Place your key bindings in this file to override the defaults
[
  {
    "key": "ctrl+m",
    "command": "-editor.action.toggleTabFocusMode"
  },
  {
    "key": "ctrl+k",
    "command": "workbench.action.terminal.clear"
  }
]