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

rg uses too much memory #48599

Closed
ghost opened this issue Apr 24, 2018 · 11 comments
Closed

rg uses too much memory #48599

ghost opened this issue Apr 24, 2018 · 11 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@ghost
Copy link

ghost commented Apr 24, 2018

Issue Type: Bug

Easy for me to reproduce:

  • git clone https://github.com/babel/babel.git
  • cd babel
  • make bootstrap
  • code-insiders .

View the system monitor, and the process rg quickly starts consuming more and more memory -- as well as 100% of my 8 cpus. If left on for more than a few seconds it will make the system unusable. (This is on Linux Mint 18.3.)

I just noticed this today after updating vscode insiders. I was editing babel yesterday with no problem, so this is probably due to a recent change. Does not reproduce with vscode non-insiders. I have no extensions installed and no custom settings.

VS Code version: Code - Insiders 1.23.0-insider (b845ce9, 2018-04-24T05:12:06.211Z)
OS version: Linux x64 4.13.0-37-generic

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (8 x 2600)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
video_decode: unavailable_software
video_encode: enabled
vpx_decode: unavailable_software
webgl: enabled
webgl2: enabled
Load (avg) 4, 4, 3
Memory (System) 7.63GB (1.57GB free)
Process Argv /usr/share/code-insiders/code-insiders .
Screen Reader no
VM 0%
Extensions: none
@roblourens
Copy link
Member

No recent changes... Can you get the command line args of that process from ps?

@roblourens roblourens added the info-needed Issue requires more information from poster label Apr 25, 2018
@ghost
Copy link
Author

ghost commented Apr 25, 2018

Based on ps aux --sort=-pmem --forest:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
andy      9902  7.0  1.4 1474528 118916 ?      Ssl  14:48   0:01 /usr/share/code-insiders/code-insiders .
andy      9956  1.4  0.8 430212 68468 ?        Sl   14:48   0:00  \_ /usr/share/code-insiders/code-insiders --type=gpu-process --no-sandbox --supports-dual-gpus=false --gpu-driver-bug-workarounds=1,7,23,61,74 --disable-gl-extensions=GL_K
andy      9910  0.0  0.3 330680 29580 ?        S    14:48   0:00  \_ /usr/share/code-insiders/code-insiders --type=zygote --no-sandbox
andy      9969 13.1  2.9 1255184 237876 ?      Sl   14:48   0:01      \_ /usr/share/code-insiders/code-insiders --type=renderer --js-flags=--nolazy --no-sandbox --primordial-pipe-token=E1124D0243E26581FCEC63DB6929C1E5 --lang=en-US --app-
andy     10024 80.5  3.0 1180160 244036 ?      Sl   14:48   0:10      |   \_ /usr/share/code-insiders/code-insiders /usr/share/code-insiders/resources/app/out/bootstrap --type=watcherService
andy     10022  6.8  0.8 997980 67684 ?        Sl   14:48   0:00      |   \_ /usr/share/code-insiders/code-insiders /usr/share/code-insiders/resources/app/out/bootstrap --type=extensionHost
andy     10052  3.0  0.8 1148816 65168 ?       Sl   14:48   0:00      |       \_ /usr/share/code-insiders/code-insiders /usr/share/code-insiders/resources/app/out/bootstrap --type=searchService
andy     10086  692 27.2 2239812 2184364 ?     Sl   14:48   1:23      |           \_ /usr/share/code-insiders/resources/app/node_modules.asar.unpacked/vscode-ripgrep/bin/rg --files --hidden --case-sensitive -g **/package.json --no-ignore
andy      9973  3.6  1.2 1076444 97308 ?       Sl   14:48   0:00      \_ /usr/share/code-insiders/code-insiders --type=renderer --js-flags=--nolazy --no-sandbox --primordial-pipe-token=855B9177D0E6A24EFAE370BB4845C82D --lang=en-US --app-

So the command is: rg --files --hidden --case-sensitive -g **/package.json --no-ignore

@roblourens
Copy link
Member

I can't repro this exact case, it's weird that the package.json search would take so long since there's one in the root and so many others. But I do see it with other extensions. This repo has a ton of symlinks for node modules which probably don't need to be followed for search, and setting "search.useSymlinks": false fixes it.

@ghost
Copy link
Author

ghost commented May 2, 2018

That solution only works until I open a file -- after that rg once again begins consuming all available memory. I am finding this out the hard way and having to hard reset my computer. There is no problem using vscode non-insiders.

@roblourens roblourens reopened this May 3, 2018
@roblourens
Copy link
Member

after that rg once again begins consuming all available memory

In that case does the process have the same arguments or are they different?

@roblourens
Copy link
Member

I can repro the original case on Linux but I don't see

That solution only works until I open a file

Is that any file or a certain type? .txt vs .js?

@roblourens
Copy link
Member

I think we expected rg --quiet --files to terminate immediately when a file is found, but it isn't. Filed BurntSushi/ripgrep#907 @chrmarti

Of course that wouldn't help a case where there is no package.json file anyway. #34711 (comment) is relevant here. I should do that this month.

@ghost
Copy link
Author

ghost commented May 3, 2018

Ran with ps again and it still seems to be running rg --files --hidden --case-sensitive -g **/package.json --no-ignore. This time it reproduced without opening any files (maybe it was just delayed before). I've double-checked that I have "search.useSymlinks": false set in my user settings, though there is an Unknown configuration setting warning.

@roblourens
Copy link
Member

Sorry, I mean "search.followSymlinks": false

@ghost
Copy link
Author

ghost commented May 3, 2018

OK, that works and I don't see rg in ps (probably because it closed quickly?).

@vscodebot vscodebot bot removed the insiders label May 3, 2018
@roblourens
Copy link
Member

Ok, cool that's what I expect. I'll close this as covered by BurntSushi/ripgrep#907 and #34711 (comment).

@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

1 participant