-
Notifications
You must be signed in to change notification settings - Fork 86
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
On macOS, under load, files appearing twice or disappearing when running ls
, unless readdir
is sorted
#57
Comments
The issue seems to be resolved when I sort files returned from a
Normally, the issue was visible at least about once every 20-30 runs of Perhaps there's an incorrect assumption in cgofuse or macfuse that the readdir results are sorted, or at least in a consistent order? That didn't hold in my case, since a go Map sorting isn't consistent... |
ls
ls
, unless readdir
is sorted
How are you using the |
Hi @billziss-gh, thanks for getting back to me! I always pass 0 for ofst when calling fill. You can find the code here: https://gist.github.com/sgielen/b229ded71f5946fc242bfb6e75e08da6#file-client-go-L211 (this is without the above patch applied, so still the ‘broken’ version.) |
Do you ever get a non-0 offset in |
BTW, one other thing I noticed is that you do not implement |
I logged this for a while, and saw no non-0 offsets given to Readdir, even as the issue appeared. I will try again, while also adding an implementation of Opendir and see if that makes a difference. |
The non-0 offsets to |
I can confirm that even with Opendir implemented, the issue still occurs. Readdir always has
The
confirming that the changes were applied. The issue is visible in the output of another terminal running
|
You said:
Cgofuse is a thin layer over the local platform's FUSE library and therefore does not (should not) make assumptions about directory entry order. There may be a problem in macfuse although I have never observed it (but in general my file systems return directory listings in consistent order). I note that in your file system every time a process issues
Did you really access a file name with an |
Perhaps then a good next step would be to try to convert this testcase to C to talk directly against the macfuse implementation and see if I can reproduce the same issue there. What do you think?
Definitely not, my testing code just runs
How do you mean this? For the same directory, this testcase always returns the same files (except indeed in a different order). But, different files are visible in |
Yes, this would be ideal. Although you would have to make sure to return the file name list in an inconsistent order.
This suggests a real problem. Is this reproducible?
Yes, I meant that the directory listing will be in different order. |
Hi @billziss-gh! I've written the testcase against macfuse in C++ and could reproduce the same issue. That's probably good news for you! ;-) I've reported the issue further upstream at macfuse/macfuse#819, along with the test case. Unfortunately, since macfuse is closed-source nowadays that means my debugging stops here. Hopefully the macfuse maintainer can reproduce and can find a fix :-) Feel free to close this issue, unless you'd like to keep tracking it. |
To answer your other question:
Yes, for me the code in the Gist linked above always reproduces the non-printable characters issue. It sometimes takes a couple minutes for the messages to appear. |
@sgielen thanks for the update and for your investigation on this. Let's keep this issue open for now so we can track the progress on the upstream issue. |
I encountered an issue on macOS where under load, a
ls
on a cgofuse-mounted filesystem would sometimes show files twice, or not show some files at all. My application is confirmed to callfill
exactly as many times with the same filenames when the issue shows as when it does not. To confirm this is an issue outside of my application, I created a simple test case: https://gist.github.com/sgielen/b229ded71f5946fc242bfb6e75e08da6The issue seems to worsen when the
Readdir
call takes longer, so my testcase Readdir implementation has a sleep between 0-200 ms in it. Furthermore, I've noticed that the lengths of filenames, and perhaps the hierarchy of the filesystem, must be reproduced in order to reproduce the bug.I can reproduce with golang 1.16.3, cgofuse 1.5.0, macfuse 4.1.2, macOS Big Sur 11.2.3. I can't reproduce on Windows or on Linux.
I'm willing to investigate further, but could use your advice for next steps.
The text was updated successfully, but these errors were encountered: