-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Search in large directories causes the system to freeze #311
Comments
The command exits succesfully when the-silver-searcher is used instead: $ ag '$SOMEVAR' 2&>/dev/null /
... |
I can reproduce it on my system. There's likely something in |
Yes, |
I can second that, it works fine when |
I hope this helps, somehow: $ strace -f -e open -- rg foobarbaz /proc &>/tmp/rg.log
|
Process 2186 is gvfsd, Gnome's virtual file system. |
OK, I've finally had time to look at this and I'm closing in on the problem. I can reproduce the issue by searching the
If I run the same command using
It turns out that Here's the bad news: Still, at the very least, With that said, one could argue that ripgrep's current buggy behavior is actually better because it is loud. Instead of silently not terminating for a very long time (like GNU grep), it will instead exhaust memory quickly and get killed. Therefore, there's a second bug. A UX bug. ripgrep really should ignore the For now, I can think of two simple workarounds if you want to continue searching
or
|
FWIW, the TL;DR is: don't search |
@BurntSushi Thanks for this thorough investigation and explanation of the problem, this was interesting to read. |
While I haven't worked on this yet, I realized something: |
re: "Therefore, there's a bug somewhere in ripgrep that's causing memory exhaustion": I would suspect this behavior is coming from Lines 580 to 612 in 214f2be
|
Yes. I mentioned that above and fixed it. |
Ah sorry, my mistake. I didn't realize I was running an old version (0.4.0) was trying to track down what possible code path could be causing my problems. Thanks for the fix in 79d40d0! |
Ripgrep uses all available system resources when something is searched within a very large directory, e.g. root
/
.It takes up the 16GB RAM of my machine instantly which causes it to freeze until the process is killed.
Here is the example call:
I am using the following ripgrep build:
The text was updated successfully, but these errors were encountered: