You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using integrated terminal to cat file with lots of unicode hangs terminal #24795
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.
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!
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).
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.
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.
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:
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!
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.
Activity
Tyriar commentedon Apr 18, 2017
I cannot reproduce using
fishorbash. What's in your settings.json?xavdid commentedon Apr 18, 2017
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:
It closes properly. If I keep waiting, the
Code Helperprocess jumps to 98% CPU usage and in another 30 sec, the dialog pops up again.xavdid commentedon Apr 18, 2017
my settings.json is here:
Tyriar commentedon Apr 19, 2017
David Brownman (@xavdid) I notice the file is in the terminal rendered correctly before you run
cat, how did you print that?xavdid commentedon Apr 19, 2017
Ah, that was the same file without the unicode. I tried it to ensure the unicode characters were the issue (not
cator something else in the file).Tyriar commentedon Apr 19, 2017
But there are still unicode characters in that file though, no? Like this one
┌xavdid commentedon Apr 19, 2017
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!Tyriar commentedon Apr 20, 2017
Oh ok, so no issue then 👍
xavdid commentedon Apr 20, 2017
I mean, there's still the hang displaying
/u2514. I was mistaken in describing it, but there's definitely a bug.Tyriar commentedon Apr 21, 2017
David Brownman (@xavdid) could you try running VS Code using
code --verboseand pasting in the output after the hang/crash?6 remaining items
silasjmatson commentedon Aug 4, 2017
I've also experienced this issue.
Using zsh on macOS Sierra.
rmunn commentedon Aug 17, 2017
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).
rmunn commentedon Aug 17, 2017
And since it hasn't been mentioned yet, I can also reproduce this on Linux (using the
bashshell), but not on Windows. Which seems consistent with Wojciech Rauner (@wrauner)'s finding that the problem seems to be in thextermmodule of the integrated terminal, since I assume that that module isn't used in the Windows build of VS Code.Tyriar commentedon Aug 17, 2017
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.
justlurking commentedon Aug 27, 2017
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!
Tyriar commentedon Aug 30, 2017
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
setTimeoutbecause it will still block. Any help on whether we can improve the regex without losing the link functionality would be helpful.Tyriar commentedon Aug 30, 2017
Peng Lyu (@rebornix) can you see anything blatantly wrong in those regexes?
Tyriar commentedon Aug 30, 2017
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 😉
xavdid commentedon Aug 30, 2017
awesome, thank you!
justlurking commentedon Aug 30, 2017
Fantastic; thanks Daniel Imms (@Tyriar)!
Fix 100% cpu crash due to regex in terminal link code