Skip to content

Using integrated terminal to cat file with lots of unicode hangs terminal #24795

Closed

Description

  • VSCode Version: 1.11.2
  • OS Version: macOS 10.12.4

Steps to Reproduce:

  1. Open integrated terminal
  2. cat a file with a lot of unicode. I found it with this file, but anything with a lot of printed unicode (eg validate\n#Validating project locally.\n#\n# \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500 ... should work

The terminal window is unable to scroll while the unicode characters are visible. When it does recover, it scrolls normally when looking at previous lines. Scrolling down to the unicode block hangs it again.

Repro Rate: 100%

Activity

  1. Tyriar commented on Apr 18, 2017

    @Tyriar
    Contributor

    I cannot reproduce using fish or bash. What's in your settings.json?

  2. added
    terminalGeneral terminal issues that don't fall under another label
    info-neededIssue requires more information from poster
    on Apr 18, 2017
  3. xavdid commented on Apr 18, 2017

    @xavdid
    Author

    Sorry, this is in zsh (v5.2) with oh_my_zsh enabled.

    I recorded a quick example video here: https://www.youtube.com/watch?v=lkpLyl8_miE

    I can scroll normally before the file is viewed, can't once it's there. After ~ 30 sec, the dead window dialog shows:

    screen shot 2017-04-18 at 3 33 40 pm

    It closes properly. If I keep waiting, the Code Helper process jumps to 98% CPU usage and in another 30 sec, the dialog pops up again.

  4. xavdid commented on Apr 18, 2017

    @xavdid
    Author

    my settings.json is here:

    // Place your settings in this file to overwrite the default settings
    {
        "editor.autoClosingBrackets": false,
        "files.trimTrailingWhitespace": true,
        "files.exclude": {
            "**/.git": true,
            "**/.svn": true,
            "**/.hg": true,
            "**/.DS_Store": true,
            "**/node_modules/**": true,
            "**/.sass-cache/**": true,
            "**/.bundle": true,
            "*.map.js": true,
            "dist": true
        },
        "editor.fontFamily": "Iconsolata, Monaco, 'Courier New', monospace",
        "window.zoomLevel": 0,
        "editor.wordWrap": "on",
        "editor.formatOnPaste": true,
        "editor.folding": true,
        "diffEditor.renderSideBySide": false,
        "standard.autoFixOnSave": true,
        "tslint.autoFixOnSave": true,
        "editor.tabSize": 2,
        "files.insertFinalNewline": true,
        "workbench.welcome.enabled": false,
        "workbench.colorTheme": "Monokai",
        "editor.minimap.enabled": false,
        "files.associations": {
          "Brewfile": "ruby"
        },
        "eslint.enable": false,
        "eslint.autoFixOnSave": true,
        "extensions.autoUpdate": true,
        "ruby.lint": {
          "rubocop": false,
          "ruby": true
        },
        "workbench.iconTheme": "vs-seti"
      }
    }
  5. Tyriar commented on Apr 19, 2017

    @Tyriar
    Contributor

    David Brownman (@xavdid) I notice the file is in the terminal rendered correctly before you run cat, how did you print that?

  6. xavdid commented on Apr 19, 2017

    @xavdid
    Author

    Ah, that was the same file without the unicode. I tried it to ensure the unicode characters were the issue (not cat or something else in the file).

  7. Tyriar commented on Apr 19, 2017

    @Tyriar
    Contributor

    But there are still unicode characters in that file though, no? Like this one ┌

  8. xavdid commented on Apr 19, 2017

    @xavdid
    Author

    oh, you're totally right. The first copy of the file is this, which has the actual unicode and works fine.

    The non-working one is after that file's been run through babel and the unicode replaced with a string (\u2514 & co). That's available here. Thanks for your patience here!

  9. Tyriar commented on Apr 20, 2017

    @Tyriar
    Contributor

    Oh ok, so no issue then 👍

  10. xavdid commented on Apr 20, 2017

    @xavdid
    Author

    I mean, there's still the hang displaying /u2514. I was mistaken in describing it, but there's definitely a bug.

  11. Tyriar commented on Apr 21, 2017

    @Tyriar
    Contributor

    David Brownman (@xavdid) could you try running VS Code using code --verbose and pasting in the output after the hang/crash?

  12. 6 remaining items

  13. silasjmatson commented on Aug 4, 2017

    @silasjmatson

    I've also experienced this issue.

    Using zsh on macOS Sierra.

    $ zsh --version
    zsh 5.2 (x86_64-apple-darwin15.4.0)
    
  14. rmunn commented on Aug 17, 2017

    @rmunn
    Contributor

    In a comment on a now-closed duplicate report, I discovered that VS Code was becoming unresponsive for X seconds, where X was directly proportional to (2 ^ length of string). E.g., if a string that could trigger the bug was pasted in, and that string was 21 characters long, I found that VS Code was freezing for about 4.5 seconds. If I added one more hex escape to the end of the string, that 22-character string would freeze VS Code for 9 seconds. A 23-character string would freeze for 18 seconds, a 24-character string would freeze for 36 seconds, and a 25-character string would freeze for 72 seconds. (I stopped at 25 characters since the pattern was clear at that point).

  15. rmunn commented on Aug 17, 2017

    @rmunn
    Contributor

    And since it hasn't been mentioned yet, I can also reproduce this on Linux (using the bash shell), but not on Windows. Which seems consistent with Wojciech Rauner (@wrauner)'s finding that the problem seems to be in the xterm module of the integrated terminal, since I assume that that module isn't used in the Windows build of VS Code.

  16. Tyriar commented on Aug 17, 2017

    @Tyriar
    Contributor

    The xterm module is used in Windows, things are handled a little differently though as pseudoterminals are emulated via the node-pty module (as opposed to being a native concept on Linux/macOS).

    Windows uses slightly different path regexes due to different formats which is probably the reason if it doesn't happen on Windows.

  17. justlurking commented on Aug 27, 2017

    @justlurking

    Any movement on solving this bug? I have the exact same issue with Unicode characters. Terminal window will not scroll for several seconds, while the Code - helper" process runs at 100% of CPU. Eventually VS Code will stop responding altogether, and I'll get the "wait or close" prompt.

    I switched from Atom to VS Code for the integrated Terminal and have found the terminal completely unusable due to this issue and the work that I'm doing.

    VSCode Version: 1.15.1 and 1.16-insider
    OS Version: macOS 10.12.6

    I've tried the insiders build, and also tried launching "code-insiders --disable-extensions" without any improvement. Repros 100% of the time. My settings file:

    { "editor.fontSize": 15, "terminal.integrated.fontSize": 14, "extensions.ignoreRecommendations": false, "window.zoomLevel": 0 }

    I've also checked the developer tools console. There are no info/warnings/errors, but under verbose logging I do see the following:

    [Violation] 'setTimeout' handler took 21294ms
    18:56:08.251 Terminal.ts:1076 [Violation] Handling of 'wheel' input event was delayed for 20800 ms due to main thread being busy. Consider marking event handler as 'passive' to make the page more responsive.
    18:56:10.943 [Violation] 'setTimeout' handler took 2685ms
    18:56:32.275 [Violation] 'setTimeout' handler took 21126ms
    18:56:32.441 [Violation] 'setTimeout' handler took 165ms
    18:56:32.939 [Violation] 'setTimeout' handler took 166ms
    18:56:33.265 [Violation] 'setTimeout' handler took 325ms
    18:56:43.882 [Violation] 'setTimeout' handler took 10616ms
    18:56:46.522 [Violation] 'setTimeout' handler took 2639ms
    18:56:46.726 [Violation] 'setTimeout' handler took 163ms
    18:56:47.383 [Violation] 'setTimeout' handler took 656ms
    18:56:47.562 [Violation] 'setTimeout' handler took 163ms

    Please let me know if I can provide any additional information to help track down and squash this bug. Thanks!

  18. Tyriar commented on Aug 30, 2017

    @Tyriar
    Contributor

    I believe it's caused by one of these regexes:

    https://github.com/Microsoft/vscode/blob/e38f1d18c7e72690c8f19a1a28fb1369431ea75a/src/vs/workbench/parts/terminal/electron-browser/terminalLinkHandler.ts#L19-L24

    The problem is that Chromium can't detect catastrophic backtracking cases and won't stop working until it finishes executing the regex. Can't even hide it in a setTimeout because it will still block. Any help on whether we can improve the regex without losing the link functionality would be helpful.

  19. Tyriar commented on Aug 30, 2017

    @Tyriar
    Contributor

    Peng Lyu (@rebornix) can you see anything blatantly wrong in those regexes?

  20. Tyriar commented on Aug 30, 2017

    @Tyriar
    Contributor

    Nevermind, I fixed it. I just disallowed \ characters in unix paths for the greater good.

    Thanks for the push Paul A. Simpson (@justlurking), should make it into v1.16.0 😉

  21. xavdid commented on Aug 30, 2017

    @xavdid
    Author

    awesome, thank you!

  22. justlurking commented on Aug 30, 2017

    @justlurking

    Fantastic; thanks Daniel Imms (@Tyriar)!

  23. locked and limited conversation to collaborators on Nov 17, 2017
  24. added a commit that references this issue on Sep 6, 2026
    b056dbf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugfreeze-slow-crash-leakVS Code crashing, performance, freeze and memory leak issuesterminalGeneral terminal issues that don't fall under another labelverifiedVerification succeeded

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions