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

Immediately dirty optimistic functions when relevant paths modified. #9007

Merged
merged 4 commits into from
Aug 11, 2017

Conversation

benjamn
Copy link
Contributor

@benjamn benjamn commented Aug 11, 2017

Should fix #8988 and #8942.

Now that #8866 is the default behavior, it can take up to 5000ms for changes to files modified during the build process to be noticed.

Before #8866, when we called e.g. files.writeFile(path), a native file watcher would notice the change immediately, almost always before the build process read the file again. This was definitely racy, but we were getting away with it consistently... until #8866.

I was able to reproduce the problem in #8988 by running

echo some-local-package-name >> .meteor/packages

in an app with a local package of the given name. After debugging the endless rebuild cycle, I found that .meteor/versions was being rewritten by files.writeFile during the build process, but the file watching system was not noticing the change in time to prevent watch.isUpToDate from returning true. The change was finally detected when restarting the Watcher responsible for .meteor/versions, which of course triggered another rebuild, so the same problem kept happening again and again.

@benjamn benjamn added this to the Release 1.5.2 milestone Aug 11, 2017
@benjamn benjamn self-assigned this Aug 11, 2017
Copy link
Contributor

@abernix abernix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Your explanation makes a lot of sense!

Should fix #8988 and #8942.

Now that #8866 is the default behavior, it can take up to 5000ms for
changes to files modified during the build process to be noticed.

Before #8866, when we called e.g. files.writeFile(path), a native file
watcher would notice the change immediately, almost always before the
build process read the file again. This was definitely racy, but we were
getting away with it consistently... until #8866.

I was able to reproduce the problem in #8988 by running

  echo some-local-package-name >> .meteor/packages

in an app with a local package of the given name. After debugging the
endless rebuild cycle, I found that .meteor/versions was being rewritten
by files.writeFile during the build process, but the file watching system
was not noticing the change in time to prevent watch.isUpToDate from
returning true. The change was finally detected when restarting the
Watcher responsible for .meteor/versions, which of course triggered
another rebuild, so the same problem kept happening again and again.
@benjamn benjamn force-pushed the immediately-dirty-optimistic-functions branch from ac9af91 to 1bfd510 Compare August 11, 2017 17:57
@benjamn benjamn force-pushed the immediately-dirty-optimistic-functions branch from 1bfd510 to 9e4d160 Compare August 11, 2017 18:13
benjamn pushed a commit that referenced this pull request Aug 11, 2017
Assuming #9007 fixes the file watcher timing problems, it should no longer
be necessary to disable the optimizations of #8866.
Copy link
Contributor

@hwillson hwillson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch @benjamn - looks great!

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

Successfully merging this pull request may close these issues.

Sometimes project keeps reloading on Meteor 1.6-beta.15
3 participants