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

Use XDG_CACHE_HOME on Linux systems for the default databaseFilename #10191

Closed
pwaller opened this issue Nov 26, 2022 · 8 comments
Closed

Use XDG_CACHE_HOME on Linux systems for the default databaseFilename #10191

pwaller opened this issue Nov 26, 2022 · 8 comments
Assignees
Labels
enhancement Improvement to an existing feature fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@pwaller
Copy link

pwaller commented Nov 26, 2022

Environment

  • OS and Version: NixOS 22.11
  • VS Code Version: 1.73.1
  • C/C++ Extension Version: v1.11.0
  • Other extensions you installed (and if the issue persists after disabling them): N/A
  • If using SSH remote, specify OS of remote machine: N/A
  • Numerous workspaces

Bug Summary and Steps to Reproduce

I hack on a number of large C/C++ projects including the linux kernel and llvm-project.

What I see is that my $HOME/.config directory contains many large binaries (tens of gigabytes, individual files >2.5GiB each), where I would rather it did not. These are the .config/Code/User/workspaceStorage/<randomhex>/ms-vscode.cpptools/.browse.VC.db files.

I consider XDG_CONFIG_HOME is meant to be the place I can store configuration I intend version control and to backup, but I can't easily do this if it contains a lot of large binaries.

I expected these large binaries to live in XDG_CACHE_HOME, which is where I go to delete things if I'm running out of disk space, the place where things should live which can be recomputed.

As an additional note, I see multiple <randomhex> directories where the workspace.json indicates that these several caches of the large caches belong to the same workspace-on-disk, so there is some unexpected duplication going on as well. The workspace.json is identical. I presume these are outdated and unused, and I would naturally clear them out by blatting my $XDG_CACHE_HOME directory, not something I intend to do with my $XDG_CONFIG_HOME.

Expected behavior

I think that large recomputable binary databases should be stored in $XDG_CACHE_DIR/vscode-cpptools alongside the existing ipch cache.

Code sample and Logs

N/A, but these repos are examples of large ones:

https://github.com/llvm/llvm-project
https://github.com/torvalds/linux

Screenshots

No response

Additional context

No response

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Nov 29, 2022

Yes, the normal behavior, which I repro, is for the database files to be written to the .cache location -- see the previously fixed bug at #3979 . i.e. something unexpected is happening for you -- do you have any idea why we may not be using your XDG_CACHE_DIR? We could also review that for possible causes.

Are those old files from an older version of our extension? Do you have the C_Cpp.default.browse.databaseFilename set?

@sean-mcmanus sean-mcmanus added Language Service more info needed The issue report is not actionable in its current state not reproing We're not able to reproduce the issue (it's unlikely to get fixed until we find one). labels Nov 29, 2022
@pwaller
Copy link
Author

pwaller commented Nov 29, 2022

I have not configured C_Cpp.default.browse.databaseFilename.

I do also have ipch cache files in ~/.cache/vscode-cpptools/ipch/*/*.ipch, in addition to the hidden browse database files living at ~/.config/Code/User/workspaceStorage/*/ms-vscode.cpptools/.browse.VC.db.

I have many of these files and they have been created recently.

I am running vscode-cpptools v1.11.0 on this version of vscode:

Version: 1.73.1
Commit: 6261075646f055b99068d3688932416f2346dd3b
Date: 2022-11-09T03:54:53.913Z
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Linux x64 6.0.9
Sandboxed: No

@sean-mcmanus sean-mcmanus added enhancement Improvement to an existing feature and removed more info needed The issue report is not actionable in its current state not reproing We're not able to reproduce the issue (it's unlikely to get fixed until we find one). labels Nov 29, 2022
@sean-mcmanus
Copy link
Collaborator

Ah, okay, you're right, I was mistaken. The database still defaults to the .config location (the referenced issue was for the IntelliSense cache files).

@sean-mcmanus sean-mcmanus added this to the On Deck milestone Nov 29, 2022
@sean-mcmanus sean-mcmanus changed the title Unexpectedly high disk usage in .config/Code/User/workspaceStorage Use XDG_CACHE_HOME on Linux systems for the default databaseFilename Nov 29, 2022
@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Nov 29, 2022

This issue was previously tracked by #1404, but it got closed due to not having enough up votes, although having a setting and changing the default are slightly different requests.

A potential workaround is to use --user-data-dir <dir> when launching VS Code to change the workspaceStorage path location.

@pwaller
Copy link
Author

pwaller commented Dec 18, 2022

I don't understand the workaround. This makes vscode write all personalized things somewhere else, yes? I wish to separate the cache from the config, since the cache is large and config is small, and I want to retain a backup of the config. If I include the caches in my backup it bloats the backups and causes differential churn in them unnecessarily, which is a problem for quick backups on low bandwidth connections and ultimately consumes more disk space in the backup than needed.

@sean-mcmanus
Copy link
Collaborator

@pwaller Yes, if you use the --user-data-dir then it won't write the files to the XDG_CONFIG_HOME.

@bobbrow bobbrow added the fixed Check the Milestone for the release in which the fix is or will be available. label Sep 5, 2023
@sean-mcmanus sean-mcmanus modified the milestones: On Deck, 1.18.0 Oct 12, 2023
@sean-mcmanus
Copy link
Collaborator

Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.18.0

@sean-mcmanus
Copy link
Collaborator

There's a follow up issue at #11696

@github-actions github-actions bot locked and limited conversation to collaborators Jan 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improvement to an existing feature fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

4 participants