Vscode: Freeze on file delete

Created on 21 Nov 2019  路  18Comments  路  Source: microsoft/vscode

Issue Type: Bug

Try to delete any file from the file explorer. The UI freezes and then offers to reopen. After reopening the file is still there. After some time (maybe a minute) the file is finally removed. Removing the file from outside VS Code is possible and is immediately reflected in the VS Code UI (deleting the file from outside removes the file from VS Code too)

VS Code version: Code 1.40.1 (8795a9889db74563ddd43eb0a897a2384129a619, 2019-11-13T16:49:30.162Z)
OS version: Linux x64 5.0.0-36-generic snap


System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i3-5020U CPU @ 2.20GHz (4 x 2066)|
|GPU Status|2d_canvas: unavailable_software
flash_3d: disabled_software
flash_stage3d: disabled_software
flash_stage3d_baseline: disabled_software
gpu_compositing: disabled_software
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: disabled_off
rasterization: disabled_software
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: disabled_software
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: unavailable_software
webgl2: unavailable_software|
|Load (avg)|3, 3, 1|
|Memory (System)|7.70GB (0.98GB free)|
|Process Argv|--force-user-env --no-sandbox --unity-launch --no-sandbox|
|Screen Reader|no|
|VM|0%|

Extensions (10)

Extension|Author (truncated)|Version
---|---|---
easy-cpp-projects|ACh|1.7.7
doxdocgen|csc|0.5.2
vscode-markdownlint|Dav|0.32.0
gitlens|eam|10.2.0
todo-tree|Gru|0.0.162
vscode-test-explorer|hbe|2.14.6
vscode-catch2-test-adapter|mat|2.7.6
cpptools|ms-|0.26.1
vsliveshare|ms-|1.0.1293
markdown-all-in-one|yzh|2.5.1


confirmed electron file-io linux upstream-issue-linked

Most helpful comment

@deepak1556 With "files.enableTrash": false the files get deleted instantly.

All 18 comments

Does this reproduce if you run with all extensions disabled?

Yes.

Can you reproduce with vscode insiders https://code.visualstudio.com/insiders/

It took about 5 seconds to delete the first file, but after that the deletions took less than a second.
The window no longer freezes or asks to reopen.

I have a similar issue:

Issue Type: Performance Issue

  • delete a file from vscode explorer
  • vscode freeze for about 10-15 seconds
  • file is deleted

VS Code version: Code 1.40.1 (8795a9889db74563ddd43eb0a897a2384129a619, 2019-11-13T16:49:30.162Z)
OS version: Linux x64 4.15.0-70-generic


System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (8 x 2109)|
|GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: disabled_software
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: unavailable_off
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled|
|Load (avg)|1, 1, 1|
|Memory (System)|7.67GB (0.13GB free)|
|Process Argv|--unity-launch|
|Screen Reader|no|
|VM|0%|


Can you reproduce with vscode insiders https://code.visualstudio.com/insiders/

fyi @deepak1556 might there be some known Electron freeze on file IO operations?

@dako98 @yukulele How is the deletion performance when you have "files.enableTrash": false setting ?

@isidorn this might be the old issue with blocking call from shell.moveItemToTrash https://github.com/Microsoft/vscode/issues/43508

@deepak1556 Yes, sounds like that one. Thanks for jumping in.

@isidorn yes

VS Code version: Code - Insiders 1.41.0-insider (615732feae7228502eab60919d67837f7a625e7c, 2019-11-27T05:36:59.072Z)
OS version: Linux x64 4.15.0-70-generic


System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (8 x 2599)|
|GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: disabled_software
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: unavailable_off
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled|
|Load (avg)|1, 1, 1|
|Memory (System)|7.67GB (3.12GB free)|
|Process Argv|--no-sandbox --unity-launch|
|Screen Reader|no|
|VM|0%|

Extensions: none

@deepak1556 With "files.enableTrash": false the files get deleted instantly.

Thanks for confirming, its definitely the issue linked in my previous comment. The fix has to come from electron https://github.com/electron/electron/issues/11555 I am leaving this issue open to avoid duplicates opened in near future.

While waiting for a patch from electron, is it not possible to use a workaround like for example running deletion in a new process?

Same here but in MacOS v10.15.3 (19D76) I decided to do what @dako98 suggested and it worked :) it's not the best solution but better than nothing

@deepak1556 With "files.enableTrash": false the files get deleted instantly.

If you don't want to disable the trash, you can set the backend from kio to gio, I wrote a post about it where I describe how to fix this https://jamezrin.name/fix-visual-studio-code-freezing-when-deleting.

But basically, you can use the ELECTRON_TRASH variable to control the backend and set it to gio, you can do this when launching vscode or make this environment variable global in your user.

Looks like the problem's been solved. No more freeze for me!

I still have this problem. UI freezes for 5-10s when I delete any file or folder.

Version: 1.50.0
Commit: 93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3
Date: 2020-10-07T06:01:33.073Z
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Linux x64 5.4.67-1-MANJARO


system information

CPUs | Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (6 x 3902)
-- | --
GPU Status | 2d_canvas: enabled flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: disabled_off opengl: enabled_on protected_video_decode: unavailable_off rasterization: disabled_software skia_renderer: enabled_on video_decode: unavailable_off vulkan: disabled_off webgl: enabled webgl2: enabled
Load (avg) | 1, 1, 1
Memory (System) | 15.47GB (9.07GB free)
Process Argv | --no-sandbox --unity-launch --crash-reporter-id f0cdbd69-fcca-406c-83a6-eb6a91500a40
Screen Reader | no
VM | 0%


extensions

Extension | Author (truncated) | Version
-- | -- | --
vscode-docker | ms- | 1.6.0
cpptools | ms- | 1.0.1
platformio-ide | pla | 2.1.2
cmake | twx | 0.0.17

I have the same problem. It freezes for every single file it tries to put into the Trash. Bug doesn't appear when completely deleting a file (Shift + Del).

Linux 5.9.4-zen1-1-zen

I guess this is still caused by the synchronous shell.moveItemToTrash function from Electron used by VS Code (https://github.com/electron/electron/issues/11555).
Electron fixed the issue by implementing an asynchronous version (shell.trashItem), but if I read the docs correctly that is included in Electron V12 (https://www.electronjs.org/docs/breaking-changes#deprecated-shellmoveitemtotrash), while VS Code still uses Electron V9.

So once VS Code bundles Electron >=V12, we can fix this issue using the new shell.trashItem function.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Perkovec picture Perkovec  路  191Comments

Tyriar picture Tyriar  路  200Comments

Tyriar picture Tyriar  路  314Comments

stoffeastrom picture stoffeastrom  路  380Comments

Tekbr picture Tekbr  路  191Comments