-
Notifications
You must be signed in to change notification settings - Fork 109
On High Sierra, dinghy appears to mark files as modified #269
Comments
Forthcoming: we are going to experiment with running on regular Docker on Vagrant and report back if that suffers the same problem. |
Is it possible that it has anything to do with this aspect of how APFS behaves, or any other aspect of APFS in particular? |
@ms-ati We (myself and coworkers) are all running High Sierra with dinghy and we haven't seen this issue across vim, macvim, neovim, atom, or vs code. Note: we all did a clean install instead of an upgrade. |
@ryansch We are seeing this universally -- every developer. We all did the upgrades of existing fairly late-model Macbook Pros, rather than clean installs. We all had our drives converted to APFS. Can you specify: In Disk Utility, is the disk where your code lives an APFS volume? |
@ms-ati Yes all of my macos volumes are inside of an APFS container. |
@mizhi They are! |
To add a bit more mystery to this, I setup a vagrant machine with docker and ran our setup in that, and did not experience the issue described above. To make sure I wasn't going crazy, I shut that down and started up everything using dinghy and immediately started getting the file modification issue. Going to dig some more on the dinghy side to see if I can suss out more answers (or better observations). |
I haven't seen this myself, but it's almost surely something to do with https://github.com/codekitchen/fsevents_to_vm which Dinghy uses to make filesystem events work across the NFS mount. So I'm not surprised that it doesn't happen with vagrant-flavored docker, since vagrant doesn't make any attempt to make fsevents work. |
...to make the above even more specific. Is it reasonable @codekitchen to hypothesize the issue is with ...specifically, that then |
That does seem the most likely culprit, though I'm not up to speed on APFS and I haven't seen this myself, yet. A quick glance through the unfs3 source code shows it uses utime for setting timestamps, which only has second-level precision, so it doesn't look likely that fsevents_to_vm can just switch to replicating over higher-resolution timestamps as a fix. |
@codekitchen I've investigated a bit and this definitely makes sense -- but it doesn't compute how this could affect some, but not all users. How is it possible that not everyone using Dinghy on APFS is experiencing this? |
Also, in principle a solution to this issue should be possible and in fact not too hard, right? I ask because, I observe that the filesystem inside dinghy is Strawman of the steps one could take here:
Of the above 3 steps, I feel least confident about (3). Thoughts? |
Yeah that's why I dug into the unfs3 source first -- patching that would be the only difficult part, though hopefully not more than a few hours work. I don't know how much work on top of that it'd be to get the patch accepted upstream, or whether they'd require parity in the Windows back-end. It does look like NFSv3 supports nanosecond-precision timestamps, so it should hopefully be possible. It's not something I'll be able to tackle myself in the near future unfortunately. |
@codekitchen Ok, lines up with my thinking as well. Our first step is to see if we can isolate and identify what is different in the setups of developers who are seeing this impact vs those who are not. You and I are discussing a reasonable hypothesis for how to fix a problem, but which doesn't seem to affect everyone. Do you have any hypothesis on how the above could possibly not impact all users? |
@ms-ati @codekitchen i suggest you to just stick with standard nfs server implementation (es: https://github.com/adlogix/docker-machine-nfs) we are using that with Dinghy and it works fairly well (https://github.com/sparkfabrik/sparkdock) |
@paolomainardi Thanks for those links, it looks like similar issues on High Sierra were faced in |
It was another kind of problem, mainly related to an operating system bug then fixed |
One thing that still confuses me: why aren't we all seeing this bug? What's different about your workflow/environment (etc)? |
@ryansch Yes! We are furiously invalidating hypotheses as quickly as we think of them. We are (un-)lucky enough to have multiple developers who see, and who are not seeing, this issue. So we are working hard to prove any hypothesis about what is different between their setups. |
I am using APFS without the encryption + native nfs server and i can't face any issues here. |
@ms-ati That's quite interesting that you have devs on both sides of the fence there. Feel free to ask for help testing any hypotheses that pan out! |
Hey all! I wanted to chime in here with some info and reproduction as well. I similarly am on an APFS volume, with encryption resulting from an in-place upgrade to High Sierra. When dinghy is not running, I do not see any file modified errors while saving files. When dinghy is running, I do see file modified errors, if I am saving while typing. This seems to lend credence to the fact that it's related to the timestamp differences between modified timestamps mentioned above. If I save a file while I am not actively typing, my editor does not prompt with any errors: Hope that helps, happy to provide more info as needed! |
Wow @seckenrode that's excellent. There's no bug quite like a race condition! |
To clarify an additional thing that we're finding interesting: The I'm not sure what that means, w.r.t. the fsevents_to_vm and the unsfd server here. Thanks! |
Another clarification: I thought that I wasn't seeing the same issue as @seckenrode. But in fact I am! It's just that I wasn't typing and saving as quickly together as he was. Steps to reproduce on my machine:
What I observe is, if I type quickly the |
It appears that the crucial reproduction step is: typing in the editor within 1 second after saving. This appears to trigger the error in Sublime Text 3 every time. It appears the difference between our developers with and without the issue was more in their typing and saving speed and habits than in their machine configurations? |
...it appears that Emacs has this worse, as by default it asks the user every time a file modification time is changed, not just when the buffer has changes that differ from disk. This behavior can be changed by the user to do what Sublime Text 3 does (compare the buffer contents to the disk contents to avoid warning when no changes) through the use of Emacs lisp, I think: |
It seems that you are aware of the problem. If it can help we also have strange behaviour with Dropbox. If you want more informations, just tell me. And, last but not least, thanks for the hard work! 👍 |
Regarding a path forward for fixing UNFS3 on High Sierra to support the nanosecond timestamps: I've filed an "Is this project alive?" bug with UNFS3 on SourceForge: If no response in one week, what would that mean? Well, it would mean that in addition to making and testing a High Sierra fix for UNFS3, we'd also have to become the de-facto upstream for the version published for Mac OS via Homebrew. Please let me know ^ if you have thoughts on the above @codekitchen ? |
Unfortunately, as you can see in the discussion with UNFS3 authors on SourceForge, that project appears to be effectively dead with no upstream authors to collaborate with. Unless someone else emerges who wants to take on development of UNFS3 to the extent that they can collaborate with us in adding support for nanosecond timestamps on APFS on High Sierra, and take on responsibility for an upstream repository and Homebrew recipe, then we are probably not going to pursue this any further. We are investigating whether Docker for Mac has improved sufficiently in recent months to be a viable replacement for Dinghy for our use cases. |
Despite @ms-ati's claims that there are no upstream developers to collaborate with, |
Hi @derfian this is fantastic news! We're so happy to hear about this. What sort of collaboration might be most helpful to you to get your branch towards something ready for production? Is there a test suite we could adapt for it, for example? |
During my lunch break, what I am trying today: Following the Homebrew instructions to make a proper pull request against Dinghy in order to use @derfian 's new branch for I'll report back here with
Any thoughts? |
Ok. To see my progress on testing @derfian UNFS3 changes in Dinghy thus far, please see this gist: I will update as I progress. Based on In order to view the local MacOS nanosecond timestamps, I did |
Here's my branch of the Dinghy Homebrew Tap where I am developing, pulling in @derfian 's branch of UNFS3, and soon to pull in my own fork of Dinghy to get the necessary support on the Thoughts? Comments? |
Update: It appears that the above-referenced branch of a. Correctly setting the nanosecond timestamps to the Mac OS server host, but Details reported on SourceForge for UNFS3 here: |
Hi @derfian -- just wondering if you thought you might have a chance to look at the above comments on your nanosecond-timestamps branch of UNFS3? Have a great weekend and thanks again! |
Great news everyone! I've verified that @derfian latest code on his branch of unfs3 works, please see my latest comment on sourceforge for details and steps to reproduce correct nanosecond behavior with Dinghy. What is left to do? Well, the correct behavior is only observed when So, the next step is to get fixes into the HUGE THANK YOU to @derfian -- do you have plans to cut a new official release of unfs3 from your branch code? |
@codekitchen Is there anyone who can help investigate the |
That's awesome. I should have time to poke at |
Hi @codekitchen there's an additional wrinkle. I have a branch of However, the One path forward that I was going to try was to have dinghy run an additional container which does contain a nanoseconds-enabled touch command, just for the purpose of replacing the ssh-to-touch with Could the existing Proxy container be extended to (a) mount the NFS-share of the host home directory, and (b) support |
@codekitchen To restate more concisely what I was saying in previous comment. First, disable your fsevent_to_vm in A. WORKING: Ubuntu's # Outside on host Mac OS
$ touch ~/test_file && gls --full-time ~/test_file
-rw-r--r-- 1 username staff 0 2018-05-17 10:39:00.592204127 -0400 /Users/username/test_file
$ docker run -it -v $HOME:/fstest ubuntu:16.04 bash
# Inside Ubuntu container
root@91e1e49f6bf2:/# touch -m -c -d 2018-05-17T14:41:04.730369000Z /fstest/test_file
root@91e1e49f6bf2:/# ls --full-time /fstest/test_file
-rw-r--r-- 1 501 dialout 0 2018-05-17 14:41:04.730369000 +0000 /fstest/test_file
# Outside on host Mac OS again
gls --full-time ~/test_file
-rw-r--r-- 1 username staff 0 2018-05-17 10:41:04.730369000 -0400 /Users/username/test_file B: BROKEN: Boot2Docker's # Outside on host Mac OS
$ dinghy ssh
# Inside Dinghy's Boot2Docker VM
docker@dinghy:~$ touch -m -c -d 2018-05-17T14:44:12.503968000Z /Users/username/test_file
touch: invalid date '2018-05-17T14:44:12.503968000Z' |
So, given that we've replaced the format_time in In the solution space that I was referencing above, I'm aware of two main shapes to get this timestamp set correctly inside the VM to trigger the inotify events in Linux: 1. Continue to SSH to BusyBoxIf we are continuing to ssh into the VM and run a command, we need something other than BusyBox's 2. Exec inside a Docker container insteadAlternatively, we could use Thoughts @codekitchen and others? |
Hi @codekitchen I know you're busy and hate to be a bother, but would really appreciate your thoughts on which direction above so I don't waste my time on a PR that you wouldn't accept. Make sense? |
Per agreement with @derfian on the unfs3 sourceforge issue here:
I will be submitting a PR to |
Hm yeah that's a bummer. Using the proxy container seems like a workable solution, my only concern would be whether there will be too much overhead doing a I wouldn't be opposed to option 1, the static binary, either, I'm just not sure about the specifics. Sorry I haven't been more responsive, I've been traveling without my laptop. If you're going to work toward this I'll hold off on doing anything this week. Thanks! |
@codekitchen No worries, I've just proven out an easy solution: literally copy the GNU coreutils |
Ok @codekitchen, PRs are up to both codekitchen/homebrew-dinghy#2 The ball is now in your court to review, and eventually to release a new version of Dinghy to pull in fsevents_to_vm when it is merged! :) |
Ping @codekitchen -- hope you get a chance to review this soon! |
Big thanks to @ms-ati for tackling this, it's never fun to wrangle changes in a dependency like unfs3. I've cut a new Dinghy release v4.6.4 with this fix, everything seems to be working well. Please report if you still see the problem or any other issues that may have cropped up. |
@codekitchen I recently updated to Catlina (from Sierra) and I am still noticing this issue. I have dinghy 4.6.5 running. I can easily test by changing anything in an xcode project (for example, updating the version number). Because xcode autosaves the change, I see a warning that the file was modified by another process. When I stop dinghy, it works as expected. |
@codekitchen ahh, it looks like I may have needed to install unfs from homebrew |
@jscheel I had the same problem, do you mind elaborating a bit more how you installed unfs from homebrew? |
Hi all, I can't claim to know exactly what is causing it, but our team has identified a major issue impeding development on Dinghy since we upgraded to Mac OS X "High Sierra" recently.
When Dinghy is running, and a file in the shared folder is edited externally (e.g. in Emacs) and saved to disk. When user attempts to edit the file again, something unexpected happens:
It should be noted that the expected thing also happens: the app inside Dinghy observes the change.
We've verified this behavior occurring in all of: Emacs, Sublime Text, and Rubymine, for example. However, for Rubymine, there is a workaround by changing to nio2 file api.
Hypothesis: Is this due to an interaction between the Dinghy NFS server and the new Apple APFS file system, which has nanosecond modification times?
We've verified that
dinghy stop
allows the editors to save files unimpeded by this issue.Any ideas? Anyone else seeing this?
The text was updated successfully, but these errors were encountered: