foambubble / foam

A personal knowledge management and sharing system for VSCode
https://foambubble.github.io/
Other
15.07k stars 647 forks source link

foam extension spawn massive rg processes in non-foam workspace #1167

Open simeld opened 1 year ago

simeld commented 1 year ago

Describe the bug

When foam extension is enabled globally and I work in a python project it seems that foam tries to search the entire virtual environment and launches a massive amount of rg processes eating up all memory and cpu capacity.

Small Reproducible Example

https://github.com/simeld/bug_vscode_foam_rg

Steps to Reproduce the Bug or Issue

See README.md in reproducible example repo

Expected behavior

As a user, I did not expect that rg would start searching the virtual environment folder .\env. It should adhere to normal ignore files like .gitignore.

Screenshots or Videos

vscode_version rg_processes

Operating System Version

Windows

Visual Studio Code Version

1.75.1

Additional context

It is related to issues: https://github.com/microsoft/vscode/issues/124230 https://github.com/microsoft/vscode/wiki/Search-Issues#slow-search-rg-running-for-a-long-time-or-consuming-lots-of-cpumemory

soultice commented 1 year ago

Can confirm the issue

riccardoferretti commented 1 year ago

Have you tried adding some folders to the exclude setting?

alexwall commented 1 year ago
Version: 1.76.0
Commit: 92da9481c0904c6adfe372c12da3b7748d74bdcb
foam: v0.21.1 

I've got the same issues when trying to copy a folder with many hidden files like .terraform and also recognised a massive delay when trying to create a new a [[new-note]] from option+click

Right now it seems to mitigate the problem, if you use this pattern to ignore all hidden files.

    "foam.files.ignore": [
        ".*/**/*"
    ],

I'd would appreciate an additional foam-option that also ignores all files and patterns from .gitignore. Maybe by default, otherwise I guess you will get more (false-positive) bug reports 😉 @riccardoferretti

riccardoferretti commented 1 year ago

Thanks for the tip, yeah ignoring hidden files feels like a reasonable default

Chaoses-Ib commented 4 months ago

image

This issue constantly causes my VS Code to crash due to OOM, especially with Rust projects since the build directory /target is not excluded by Foam and there are a lot of files. After being bothered by this problem hundreds of times, I finally found this was caused by Foam. Now I uninstalled Foam and everything works fine.

Other reports:

bellicapax commented 2 months ago

I think I've found this same issue happening for me. I think it is dependent upon having Markdown All-In-One enabled alongside Foam a la this issue https://github.com/yzhang-gh/vscode-markdown/issues/1225 When I have only one or the other enabled, the problem does not occur.

AaronFriel commented 6 days ago

I've run into the same issue that @bellicapax identified - an interaction between Foam and Markdown All In One results in crashes with an OOM. I've disabled Foam as it wasn't worth having a non-usable editor.

Would be great if the authors here could work with Markdown All in One to identify what causes this feedback loop.