Skip to content

Cleanup ExtensionContext.workspaceState when a workspace no longer exists #32461

Open
@dbaeumer

Description

@dbaeumer
No description provided.

Activity

added this to the August 2017 milestone on Aug 14, 2017
self-assigned this
on Aug 14, 2017
bpasero

bpasero commented on Aug 15, 2017

@bpasero
Member

@dbaeumer how do we know that a workspace no longer exists? Imho just checking for existence of the path is not enough, there may be many users that work via a remote network drive or even a mounted disk where the connection is not always there. Just going by fs.exists imho can result in bad user experience for these users.

dbaeumer

dbaeumer commented on Aug 15, 2017

@dbaeumer
MemberAuthor

@bpasero the network drive case is an interesting case I never thought about. We could do the following: if it is a UNC path \...\ and it doesn't exist we leave the workspace storage. Same for a drive letter that doesn't exist. We could prompt the user with a list so that he could clean them manually.

bpasero

bpasero commented on Aug 15, 2017

@bpasero
Member

@dbaeumer not sure it is that easy, for example VMs can map a folder into my macOS and this folder is not there if the VM is not started. The path itself does not indicate if it is from a VM/remote or not.

dbaeumer

dbaeumer commented on Aug 16, 2017

@dbaeumer
MemberAuthor

@bpasero I am not sure I fully understand that example. How would the storagePath and the workspace folder be layout in that case. Would the storagePath be inside the VM and the workspace folder location mounted into the VM?

bpasero

bpasero commented on Aug 16, 2017

@bpasero
Member

@dbaeumer no, the extension storage will always be on the disk where VS Code is installed (e.g. %APPDATA%). I was trying to comment on your statement:

We could do the following: if it is a UNC path ...\ and it doesn't exist we leave the workspace storage. Same for a drive letter that doesn't exist.

On Linux and macOS there are no UNC paths and there are no drive letters. Paths can come and go depending on mounts (e.g. a parallels VM started or stopped), so by just looking at the path you will not be able to find out if the path was deleted or not mounted.

dbaeumer

dbaeumer commented on Aug 24, 2017

@dbaeumer
MemberAuthor

After taking @bpasero input into consideration it is clear that we can't simply delete workspace storage folders. So we need some UI affordance that point to large workspace storage folders and ask the user whether we should clean it up or not

//cc @egamma @kieferrm

modified the milestones: On Deck, August 2017 on Aug 24, 2017
neerolyte

neerolyte commented on Apr 9, 2018

@neerolyte

I'd appreciate some options to choose clean up strategies, checking if it exists is fine if you don't use network paths (maybe you could detect if it's a network mount when creating the workspace files in the first place?). If it is a network mount, perhaps just cleaning up LRU (Least Recently Used) would be fine?

I just noticed this directory is 35GB on my laptop, with some of the oldest workspaces being nearly a year old and most of them no longer existing (I tend to a roll out a new workspace per feature branch on one project I work on).

50 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalityworkbench-stateUI state across restarts

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Cleanup ExtensionContext.workspaceState when a workspace no longer exists · Issue #32461 · microsoft/vscode