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

Out of memory #228

Closed
andyleejordan opened this issue Nov 9, 2016 · 3 comments
Closed

Out of memory #228

andyleejordan opened this issue Nov 9, 2016 · 3 comments
Labels
bug A bug.

Comments

@andyleejordan
Copy link
Contributor

I managed to break ripgrep somehow.

$ git clone https://github.com/docker/docker.git
$ cd docker

$ rg --ignore-file vendor tar
fatal runtime error: out of memory
^C^C^C^CIllegal instruction (core dumped)

$ rg --version
ripgrep 0.2.8

$ uname -r
4.8.6-1.el7.elrepo.x86_64

This is on CentOS 7 virtualized with Hyper-V.

I have since realized that --ignore-file was not what I wanted (I'm trying to exclude files). It's actual intention is a file which lists what to be ignored. However, by giving it a directory (any directory) I manage to crash ripgrep pretty easily.

@andyleejordan
Copy link
Contributor Author

@BurntSushi is it intended that --ignore-file accepts and walks a directory for ignore files? If it is not, I think I can fix it rather simply by denying the use of directories.

@BurntSushi
Copy link
Owner

This is an awesome bug, thanks for the report!

The issue was that I got a bit overzealous with partial error reporting. Namely, when processing a gitignore file, we should try to use every pattern even if some patterns are invalid globs (e.g., a**b). In the process, I applied the same logic to I/O errors. In this case, it manifest by attempting to read lines from a directory, which appears to yield Results forever, where each Result is an error of the form "you can't read from a directory silly." Since I treated it as a partial error, ripgrep was just spinning and accruing each error in memory, which caused the OOM killer to kick in.

@BurntSushi BurntSushi added the bug A bug. label Nov 9, 2016
@andyleejordan
Copy link
Contributor Author

Yay! This is why I love ripgrep. It's already fixed! Thanks @BurntSushi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug.
Projects
None yet
Development

No branches or pull requests

2 participants