-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
fd can get stuck when ran onto the whole FS from the root #288
Comments
I can reproduce this on my PC. This seems to be a permission problem with files in Could you try to run
where (Note: you might have to exclude some other mount points as well) |
Indeed this does work. Strange that my personal server doesn't have the same issue though. |
Oh, and the issue was present even when running fd as root. So I'm not sure about the permission idea. |
I see, interesting. Something else must be going on inside |
Excluding only |
Even more interesting. |
Wait, this also seems to change from time to time. Right now, |
I suspect this could be caused by infinite recursion within Quote:
Unfortunately, I cannot reproduce the problem at the moment. Could you try
? |
I'm going to close this (for now), as there is no further feedback. Feel free to comment here if this should be re-opened. The workaround for now is to explicitly exclude
|
Sorry, didn't knew you was waiting for input: it was added with an edit, so I wasn't notified: original comment was not asking for input. Please post a new comment in such situation. I tested what you asked for: didn't solved the issue, so I guess this isn't infinite recursion. I guess we could then reopen it? EDIT: Even if I'm the opener I can't reopen myself. |
By the way, this was on Linux computers. EDIT: CPU lowered to 1.5-2%, but it still continue. EDIT2: Might not be the bug on the mac, 30 minutes later, it found a file with "foobar" in the name (!) at the 9th level of depth. So I'll see this evening if it ended correctly, the HDD is kinda slow, and probably fd is slowed down by I/O on disk rather than CPU like other SSD-using computers. |
So, not reproduced on the mac, it just took quite some time. |
Thank you for investigating. To summarize (correct me if I'm wrong):
|
Well, that's pretty much it except that I detected a weird case in comment #288 (comment) The exact same computer I did the tests on yesterday morning now succeed on |
Yeah, this seems really random. The laptop now do it again, the one that didn't 2H ago and the desktop don't anymore… Do you have any idea how to debug that? See where does it hang like that? And this is kinda out of topic, but per comment #288 (comment) is it normal that on the mac case memory did increase during the whole search process? |
Maybe
I'm not sure, I will look into it. |
Okay, so running The laptop's case however is more complicated. It seems to stop randomly on any file at some point. I can share some of them here if you think that's useful but I'm not sure about that. Maybe a doing single thread might help. Don't know why one computer is affected while the other isn't though. |
Okay, actually I just RTFM'd a bit and used Got stuck on
|
Oh, and surprisingly, using And last thing but I've no idea about: sometimes when the bug triggers it "breaks" the terminal I used, terminology. ie. display was still refreshed, but I couldn't type anymore, even when I opened new windows. Only happened one time or two, and got fixed when I pkill'd the process from elsewhere. EDIT: When it happens, ctrl + c don't do the trick, but seems to work if you wait a long time and retry after having done so a first time. |
Thank you very much for your investigation! It looks like you are up to something with the
Experiment 2:
|
(see the linked ticked in ripgrep for some further debugging) |
This might be a bug in the |
My pull request which fixes a bug in Rusts standard library has been merged (rust-lang/rust#50630). Now we have to wait for the next Rust release in order to fix this bug in |
Actually, we have to wait for Rust 1.29. I forgot about the beta stage. This bug is fixed when compiling |
This upgrades the minimum required version of Rust to 1.29 in order to fix #288. See also: - Rust compiler bug ticket: rust-lang/rust#50619 - Rust compiler PR with the fix: rust-lang/rust#50630 closes #288
This upgrades the minimum required version of Rust to 1.29 in order to fix #288. See also: - Rust compiler bug ticket: rust-lang/rust#50619 - Rust compiler PR with the fix: rust-lang/rust#50630 closes #288
This is finally fixed! ✨ |
Fix released in fd-7.2.0. |
This issue seems to still exist on version 8.6.0 Running "cd /proc && fd teststring" will make fd freeze and use up all cpu cores (until I cancelled the operation after a minute) |
Interesting, I can't reproduce that locally. Otherwise, does it still reproduce with |
Running 'fd -j1' will list files until it stopped at 24677/map_files/ I suspect this may have to do with the sandboxing features in firefox, since it also uses seccomp and blocks ptrace. However, this one seems to be unreliable to reproduce sicne it I could not reproduce it on a clean test install The strace log shows a bunch of logs that repeats endlessly https://gist.github.com/monkeyt00l/30a2bdcd3544db3fbc896acc934bbc30 The pids in the log also seem to belong to firefox content processes |
Hmm, from looking at the strace output I wonder if this is related to #1186 . It seems like in both cases fd is getting stuck in an infinite loop due to an error (in this case, a permission error). |
I hope so! EACCES is much easier to debug than EIO :) |
I can reproduce this now: tavianator@graphene$ (sleep 1& (sleep 2 && fd . /proc/${!}/net --show-errors)& exec /bin/sleep 3)
[fd error]: Invalid argument (os error 22)
[fd error]: Invalid argument (os error 22)
[fd error]: Invalid argument (os error 22)
[fd error]: Invalid argument (os error 22)
[fd error]: Invalid argument (os error 22)
[fd error]: Invalid argument (os error 22)
[fd error]: Invalid argument (os error 22)
[fd error]: Invalid argument (os error 22)
[fd error]: Invalid argument (os error 22)
[fd error]: Invalid argument (os error 22)
... That command creates a zombie process (the Those with a long memory might remember the bug rust-lang/rust#50619, which @sharkdp filed and then fixed as a result of this bug. Unfortunately, some silly programmer named @tavianator reintroduced the bug in rust-lang/rust#92778. Or to be a little more charitable, the original fix only applied to some platforms, of which Linux used to be one. But now Linux uses a different I guess I'll fix it in Rust, unless someone beats me to it. |
Here's the fix: rust-lang/rust#105638 |
So if I understand correctly, your PR landed in Rust 1.60. Which is precisely our MSRV right now 😄. So there's currently no way to fix this bug by compiling with an older version of |
clap 4.0 has an MSRV of 1.60, so we'd probably have to downgrade clap to 3.x again if we did that. |
Alternatively we can work around it in if result.is_err() {
break;
} |
Did that: BurntSushi/ripgrep#2378 |
I'm now seeing this issue on macOS, with the latest release |
That'd be great. |
Apols, resolved this on my side, it was a heavily under performing disk. |
The ran command is just
fd foobar /
. It gets stuck and never end. I sadly was unable to understand what's causing it.I can investigate to give answers if you have some ideas about what else could I check.
Below is the partition's setup:
EDIT: Issue is reproducing everytime on this Archlinux setup. Couldn't reproduce it on another Archlinux with unencrypted system.
The text was updated successfully, but these errors were encountered: