Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode becomes unresponsive after pasting filename with many dots in file tree #116199

Closed
ghost opened this issue Feb 9, 2021 · 6 comments · Fixed by #116268
Closed

VSCode becomes unresponsive after pasting filename with many dots in file tree #116199

ghost opened this issue Feb 9, 2021 · 6 comments · Fixed by #116268
Assignees
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues help wanted Issues identified as good community contribution opportunities insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Milestone

Comments

@ghost
Copy link

ghost commented Feb 9, 2021

  • VSCode Version: 1.53.0 (commit id: 8490d3d)
  • OS Version: Ubuntu 20.04.2 LTS (Kernel: Linux 5.4.0-65-generic)

I stumbled upon this bug by accident when I had the contents of some large file in my clipboard and (not realizing I had these file contents in the clipboard) when I pasted it in the filename of the file explorer of VSCode, it became unresponsive to the point I had to force kill it. In my opinion it is not very critical, not many people with encounter this issue, it was just surprising that my vscode became unresponsive due to this. I tried to locate the source of the issue in the code, but I couldn't find it myself.

Steps to Reproduce:

  1. open a directory in VSCode such that you have some file existing in the Explorer
  2. copy some filename with many dots to the clipboard. I use python -c "print('a.' * 50000)" | xclip -sel clip for this
  3. select the file and click rename F2, followed by CTRL-V to paste the string
  4. observe vscode is unresponsive for more than 30 seconds, after which I force kill it.

I found out that when you would paste 100.000 characters without using dots (i.e. python -c "print('ab' * 50000)" | xclip -sel clip), then VSCode responds very quickly and lets me know the filename is invalid.

Since the maximum allowed length of a filename is 255 characters, I think it would suffice to limit the filename to 255 characters before any further parsing is done.

Does this issue occur when all extensions are disabled?: Yes / no

@jrieken
Copy link
Member

jrieken commented Feb 9, 2021

I can reproduce. Looks like the getIconClasses-function is causing this.

Profile-20210209T161958.json.txt

Screenshot 2021-02-09 at 16 17 22

@jrieken jrieken added the freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues label Feb 9, 2021
@jrieken
Copy link
Member

jrieken commented Feb 9, 2021

my "fill clipboard snippet" is this setTimeout(() => navigator.clipboard.writeText(new Array(50000).fill('a').join('.')), 3000). Open dev-tools, paste and run, and within the 3sec focus the content window

@aeschli aeschli assigned bpasero and unassigned aeschli Feb 9, 2021
@bpasero bpasero added the help wanted Issues identified as good community contribution opportunities label Feb 9, 2021
@bpasero bpasero added this to the February 2021 milestone Feb 9, 2021
@bpasero
Copy link
Member

bpasero commented Feb 9, 2021

Since it happens inside the method, like something that was added around here: a84b272

@jeanp413
Copy link
Contributor

I'll take a look at this

jeanp413 added a commit to jeanp413/vscode that referenced this issue Feb 10, 2021
bpasero pushed a commit that referenced this issue Feb 19, 2021
@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug author-verification-requested Issues potentially verifiable by issue author labels Feb 19, 2021
@jrieken jrieken added the verified Verification succeeded label Feb 25, 2021
@jrieken
Copy link
Member

jrieken commented Feb 25, 2021

Still quite slow but not freezing anymore

@github-actions github-actions bot locked and limited conversation to collaborators Apr 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues help wanted Issues identified as good community contribution opportunities insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@bpasero @jrieken @aeschli @jeanp413 and others