Vscode: Freeze when deleting files via trash

Created on 8 Jul 2020  路  16Comments  路  Source: microsoft/vscode




  • VSCode Version: 1.46.1
  • OS Version: openSUSE Tumbleweed
  • TypeScript: 3.7.5 (project) 3.9.4 (vscode)

Steps to Reproduce:

  1. npx create-react-app --typescript --use-npm my-app
  2. code my-app
  3. Copy paste App.tsx file to App copy.tsx
  4. Delete App copy.tsx
  5. VS Code window freezes for 5~10 seconds


Does this issue occur when all extensions are disabled?: No

electron freeze-slow-crash-leak linux upstream-issue-fixed

Most helpful comment

The issue is that KDE (why I assume you are using) uses a different electron backend for managing file deletion.

It's actually super slow when moving files to the trash.

You can specify the backend globally and fix this issue this way, you can see more in a post I wrote about this: https://jamezrin.name/fix-visual-studio-code-freezing-when-deleting

All 16 comments

Can you follow this wiki and post the results back here to understand more about why performance is so bad for you: https://github.com/Microsoft/vscode/wiki/Performance-Issues

Thanks!

I did the "Profiling the Renderer Process":
CPU-20200708T151518.cpuprofile.zip

code --status doesn't work because when the window freeze, code --status doesn't response, too.

Thanks, I see a lot of idle unfortunately, which is not code from us:

image

Can you install htop and monitor which process in VSCode is potentially high CPU? If any?

I didn't see any process using high CPU when the window freeze. All processes use < 3% CPU.

@guoyunhe can you try "Shift+Delete" to bypass the trash. Wondering if it could be trash related.

Yeah, Shift+Delete works smoothly. No freeze.

Moving to Electron then, the issue seems to be that moveItemToTrash is slow on Linux.

The issue is that KDE (why I assume you are using) uses a different electron backend for managing file deletion.

It's actually super slow when moving files to the trash.

You can specify the backend globally and fix this issue this way, you can see more in a post I wrote about this: https://jamezrin.name/fix-visual-studio-code-freezing-when-deleting

@jamezrin Thanks for the info. I can contact KDE community to see if they can do something on their side.

@bpasero could the moveToTrash() call be moved from rendering thread to a different thread? Even if the performance is improved in Electron or KDE, the function is not async and can make window no response when deleting a large amount of files.

@guoyunhe currently we do not have a different process that can run this method. If do not want to move it into the electron main process as blocking that process would mean any user interaction is blocked across all windows. I think Electron needs to resolve this, or maybe run it in a different thread if it is known to block.

Any updates on this? This issue is present for very long time. Should be addresed by https://github.com/electron/electron/pull/25114?

I'm running KDE on Arch and I still have the same issue.

Potential workaround (works for me) described in this comment on a duplicate issue: https://github.com/microsoft/vscode/issues/90034#issuecomment-582115953
(Setting ELECTRON_TRASH environment variable)

I see that setting an Env variable will probably fix this. Thanks for pointing out.

Is there a plan to make vscode independent of this variable (like packaging the value inside vscode, or any other solution?)

Or at least, update the installation docs for linux to instruct affected users to do this?

Potential workaround (works for me) described in this comment on a duplicate issue: #90034 (comment)
(Setting ELECTRON_TRASH environment variable)

Temporary workaround confirmed on ArchLinux + KDE

export ELECTRON_TRASH=gio
Was this page helpful?
0 / 5 - 0 ratings