Skip to content

Respect global search exclusions #699

@psalaberria002

Description

@psalaberria002

Describe the bug

I am seeing very long running search queries coming from the vitest extension, trying to find package.json files.

The repository has symlinks at the root for bazel related folders. These folders have millions of files. We have added exclusions for these folders in search.exclusions, but they are not respected. Setting "search.followSymlinks": false solves the issues, but it took me a while to figure it out.

Similar to microsoft/vscode#98594

Reproduction

Have a directory with lots of nested folders (bazel-bin, bazel-out,...) at the root of the repo.

Add global search.exclusions for those folders.

Open vscode, and run ps aux | grep rg in a terminal.

A long running process similar to this should be shown:

/usr/share/code/resources/app/node_modules/@vscode/ripgrep/bin/rg --files --hidden --case-sensitive --no-require-git -g '**/package.json' -g '!**/.git' -g '!**/.svn' -g '!**/.hg' -g '!**/.DS_Store' -g '!**/Thumbs.db' -g '!**/.classpath' -g '!**/.project' -g '!**/.settings' -g '!**/.factorypath' -g '!/{**/node_modules/**,**/.*/**,**/*.d.ts}' --no-ignore --follow --no-config --no-ignore-global

Setting "vitest.configSearchPatternExclude": "{**/node_modules/**,**/.*/**,**/*.d.ts,bazel-*}" also fixes the issues, but that config is specific to vitest.

Output

After a few minutes after opening vscode:

[INFO 13:28:32] [v0.0.0] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 13:31:15] [API] Resolving configs: infrastructure
[INFO 13:31:15] [API] Running Vitest v4.0.5 (infrastructure) with "/home/paulsmsm/.nvm/versions/node/v20.11.1/bin/node /home/paulsmsm/.vscode/extensions/vitest.explorer-1.36.0/dist/worker.js"
[INFO 13:31:50] [Worker] 
<--- Last few GCs --->

[179512:0x29406240]    33772 ms: Mark-Compact 4044.0 (4133.3) -> 4033.9 (4138.8) MB, 802.77 / 0.00 ms  (average mu = 0.419, current mu = 0.038) allocation failure; scavenge might not succeed
[179512:0x29406240]    35103 ms: Mark-Compact 4049.8 (4138.8) -> 4040.0 (4144.5) MB, 1303.55 / 0.00 ms  (average mu = 0.214, current mu = 0.021) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

[INFO 13:31:50] [Worker]  1: 0xca5580 node::Abort() [/home/paulsmsm/.nvm/versions/node/v20.11.1/bin/node]
[INFO 13:31:50] [Worker]  2: 0xb781f9  [/home/paulsmsm/.nvm/versions/node/v20.11.1/bin/node]
[INFO 13:31:50] [Worker]  3: 0xeca4d0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/home/paulsmsm/.nvm/versions/node/v20.11.1/bin/node]
[INFO 13:31:50] [Worker]  4: 0xeca7b7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/home/paulsmsm/.nvm/versions/node/v20.11.1/bin/node]
[INFO 13:31:50] [Worker]  5: 0x10dc505  [/home/paulsmsm/.nvm/versions/node/v20.11.1/bin/node]
[INFO 13:31:50] [Worker]  6: 0x10f4388 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/home/paulsmsm/.nvm/versions/node/v20.11.1/bin/node]
 7: 0x10ca4a1 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/home/paulsmsm/.nvm/versions/node/v20.11.1/bin/node]
[INFO 13:31:50] [Worker]  8: 0x10cb635 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/home/paulsmsm/.nvm/versions/node/v20.11.1/bin/node]
[INFO 13:31:50] [Worker]  9: 0x10a7d56 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [/home/paulsmsm/.nvm/versions/node/v20.11.1/bin/node]
[INFO 13:31:50] [Worker] 10: 0x1099984 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Map, v8::internal::AllocationAlignment) [/home/paulsmsm/.nvm/versions/node/v20.11.1/bin/node]
11: 0x109c166 v8::internal::FactoryBase<v8::internal::Factory>::NewRawOneByteString(int, v8::internal::AllocationType) [/home/paulsmsm/.nvm/versions/node/v20.11.1/bin/node]
[INFO 13:31:50] [Worker] 12: 0x13ec3a7 v8::internal::String::SlowFlatten(v8::internal::Isolate*, v8::internal::Handle<v8::internal::ConsString>, v8::internal::AllocationType) [/home/paulsmsm/.nvm/versions/node/v20.11.1/bin/node]
[INFO 13:31:50] [Worker] 13: 0x152545d v8::internal::Runtime_StringCharCodeAt(int, unsigned long*, v8::internal::Isolate*) [/home/paulsmsm/.nvm/versions/node/v20.11.1/bin/node]
14: 0x7eb987ed9ef6 
[13:31:51] [API] Vitest WebSocket connection closed, cannot call RPC anymore.
[INFO 13:31:51] [API] Reloading API due to unexpected empty exit code.
[Error 13:31:51] Failed to close server
[Error 13:31:51] [Error Error] [birpc] rpc is closed, cannot call "getFiles"
Error: [birpc] rpc is closed, cannot call "getFiles"
	at /home/paulsmsm/.vscode/extensions/vitest.explorer-1.36.0/dist/extension.js:7:41423
	at Map.forEach (<anonymous>)
	at Proxy.d (/home/paulsmsm/.vscode/extensions/vitest.explorer-1.36.0/dist/extension.js:7:41386)
	at t.<anonymous> (/home/paulsmsm/.vscode/extensions/vitest.explorer-1.36.0/dist/extension.js:12:2427)
	at Object.onceWrapper (node:events:634:26)
	at t.emit (node:events:531:35)
	at t.emitClose (/home/paulsmsm/.vscode/extensions/vitest.explorer-1.36.0/dist/extension.js:1:29126)
	at Socket.Wi (/home/paulsmsm/.vscode/extensions/vitest.explorer-1.36.0/dist/extension.js:1:39260)
	at Socket.emit (node:events:519:28)
	at TCP.<anonymous> (node:net:346:12)

Extension Version

1.36.0

Vitest Version

4.0.5

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions