-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
test_vfs_works failed on Mac OS X #734
Comments
I looked at this with @matklad today via zulip. Based on instrumentation I added as suggested by @matklad , we determined that OS X seems to generate a @matklad is planning to fix this on the side of |
More info: further investigation revealed that the tempdir library is creating directories hosted under We are looking into it further now. |
(BTW this is not specific to OS X version 10.14.2; I am using 10.13 and I believe this |
Suggested fix: change RootConfig to pub(crate) struct RootConfig {
root: PathBuf,
// result of root.canonicalize() if it is different from root
canonical_root: Option<PathBuf>,
excluded_dirs: Vec<PathBuf>,
} and use both I did a quick skim over other usages of |
Hm, thinking about it more, I think we should change |
Q: why store two paths instead of just always canonicalizing the file? A: we might be unable to canonicalize paths coming from the client of the language server! Consider the case where the client starts the server in a symlinked dir and then sends a "didOpenTextDocuemnt" request for a not-yet-saved document, using this non-canonical symlinked path. We would be unable to obtain canonical path here, because the file does not exists. |
After implementing the experiment above (to store both the
which corresponds to this code (I've added some However, there is still a |
... so far, regarding the failure described in the previous comment, my experiments seem to indicate that we might not be getting a |
I think that
Could you send a PR with this? It definitely fixes at least one bug, and is a clear improvement. |
yeah I've tried adding timeouts as well as |
I wonder if we should setup testing on MacOS... My hope is to keep most of the rust-analyzer 100% platform-independent, such that there's no need to test on more than one platform (which is great for CI times!). However we need to touch OS somewhere. Currently, this is isolated to EDIT: splitting of a separate issue |
posted in PR #818 (I did not attempt to make a regression test though. I might imagine ways could attempt to do so, but it seems like a bit of a OS-dependent rabbit hole.) |
If you want to take a look, I posted the results of a log with my current instrumentation (as well as the diff for said instrumentation, atop PR #818) at the following gist: https://gist.github.com/pnkfelix/985658b6d4b610cd72f435f952bdb53f (this particular version has the sleep calls commented out, but the results were much the same when I had them in. In some scenarios I did notice glitches in the earlier |
I think the interesting part of the log is
note that last too entries should probably be swapped (this is ok, they are from different threads). My understanding is that, when we crate When we rename, we do get evet for cc @vemoo |
Not sure if related to this issue, but currently Output:
|
But the event that we recieve from notify should be a rename event.
@pnkfelix can you try to run the test in a normal folder (not in |
818: In `RootConfig::contains`, check against canonicalized version of root path r=matklad a=pnkfelix In `RootConfig::contains`, check against canonicalized version of root path since OS may hand us data that uses the canonical form rather than the root as specified by the user. This is a step towards a resolution of issue #734 but does not completely fix the problem there. Co-authored-by: Felix S. Klock II <[email protected]>
yeah I just tried that by making the temp dir be just my home directory (in canonical form), and I still don't see a rename event; only a create of |
(but at this point I'm thinking the right next step is to reduce this to an issue with the notify crate, and file a bug there.) |
@dfaust points out here that fsevents can merge events within a 30 second buffer. That could explain why e.g. I am seeing remove events for Possible work-arounds for this we might adopt in our own test suite:
|
see also relevant comments on this thread regarding rename handling being a mess on OS X: notify-rs/notify#89 (comment) |
I wouldn't want to add huge delays: it's important that |
Okay, update on current situation:
So now I have another approach to suggest, that is more along the lines that was used to resolve #830: change the test suite to allow more flexible specification of the number of events we expect to receive on the task_receiver. I'll have a PR up shortly showing what I mean. |
837: Generalize vfs.rs test to address fsevents timing-dependent behavior. r=matklad a=pnkfelix Generalize `tests/vfs.rs` processing to address wildly-varying timing-dependent behavior from fsevents (i.e. on Mac OS X). Fix #734 Co-authored-by: Felix S. Klock II <[email protected]>
cargo 1.32.0 (8610973aa 2019-01-02)
The text was updated successfully, but these errors were encountered: