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

Disable fsevents by default #60

Closed
wants to merge 1 commit into from

Conversation

MylesBorins
Copy link

Since it would be a Semver-Major change to update chokidar this seems
like the next best thing. This explicitly opts-out of using fsevents
when instantiating chokidar as a default option. Folks could still
manually change this behavior if they wished. While this is a behavior
change it should only make things "slower" not "less reliable" and
would avoid the breakages we are seeing on 12 / 14 which appear to be
caused by .stop() being called on the watcher when nothing is being
watched, which might be a race condition in the tests.

Since it would be a Semver-Major change to update chokidar this seems
like the next best thing. This explicitly opts-out of using fsevents
when instantiating chokidar as a default option. Folks could still
manually change this behavior if they wished. While this is a behavior
change it should only make things "slower" not "less reliable" and
would avoid the breakages we are seeing on 12 / 14 which appear to be
caused by .stop() being called on the watcher when nothing is being
watched, which might be a race condition in the tests.
@@ -13,6 +13,7 @@ var defaultOpts = {
ignored: [],
ignoreInitial: true,
queue: true,
useFsEvents: false,
Copy link
Author

Choose a reason for hiding this comment

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

alternative we could sniff version number and only apply this extra option for OSX + >=12.x

Copy link
Member

Choose a reason for hiding this comment

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

I like sniffing. Might even want to include the patch version. We have some patterns for that so I'll look after work.

@phated
Copy link
Member

phated commented Jul 22, 2020

Hmm, this causes our test suite to randomly fail so I don't think I can ship it 🤔

@phated
Copy link
Member

phated commented Jul 23, 2020

which appear to be caused by .stop() being called on the watcher when nothing is being watched

@MylesBorins could that be solved by not calling .stop() in the gulp tests? I assume that's the difference between the tests here and the gulp tests. Gulp tests are really just smoke tests on top of all our other heavily-tested libraries.

@phated phated closed this Jul 23, 2020
@MylesBorins
Copy link
Author

Could you reopen this? I'd love to dig into the fails a bit and figure out what is going on here.

It passed locally, and the change should have 0 observable change on non osx.

I can do some local tests as well with what's going on with close... But keep in mind the fsevents crashes are happening on both 12 and 14, that specific backtracke we did was only on 12

@phated phated reopened this Jul 23, 2020
@phated
Copy link
Member

phated commented Jul 23, 2020

With these changes, I am getting flakey failures on MacOS 10.15.5 - note that we don't run MacOS in our current CI but our new project scaffold will update our CI to GH Actions and testing on Mac.

@MylesBorins
Copy link
Author

MylesBorins commented Jul 23, 2020

@phated which versions of node are you seeing the flaky failures on? I'm not able to reproduce on MacOS 10.15.5 using Node.js v10.22.0, v12.18.3, or v14.6.0

Are the failures you are seeing related to time outs?

FWIW I am consistenly getting Abort traps (internal failures) on 12.18.3 and 14.6.0 and they are entirely related to the calls to watcher.close(); in the afterEach function call

@phated
Copy link
Member

phated commented Jul 23, 2020

Mac 10.15.5, Node 12.18.3 - with this patch I'm getting (random) tests that never complete, even with a timeout of 0 set (disabled).

I haven't had glob-watchers' test suite fail yet while working on the 2 patches I released last night.

@MylesBorins
Copy link
Author

MylesBorins commented Jul 23, 2020

@phated that is extremely strange because I cannot get the test suite to pass at all on Mac OSX 10.15.5 with 12.18.3. Do you have time to pair on this at all tomorrow?

edit: to be clearer, the test suite doesn't pass without this change... so very odd that we are having opposite experiences

@MylesBorins
Copy link
Author

how did you install node?

@phated
Copy link
Member

phated commented Jul 23, 2020

nave usemain 12 and then verified the version. Looks like I got the binary

@MylesBorins
Copy link
Author

MylesBorins commented Jul 23, 2020 via email

@phated
Copy link
Member

phated commented Jul 23, 2020

Sorry, I'm at my work computer right now, not my personal. I'll have to check later.

@phated
Copy link
Member

phated commented Jul 24, 2020

@MylesBorins you were right, I must have built fsevents on a non-broken node and then switched to the newly broken node. Rebuilding causes the abort traps

@MylesBorins
Copy link
Author

@phated are you able to reproduce the failures you say you were seeing with this change? I could not get any flakes with this change

@phated
Copy link
Member

phated commented Jul 24, 2020

It's look like about 1 in 10 runs will have a test that just won't complete. I'm not sure why.

@phated
Copy link
Member

phated commented Jul 24, 2020

@MylesBorins I'm also wondering if this actually affects any end-users because we don't recommend or guide users to use watcher.close() in their applications. So is this just a workaround for the test suite?

@MylesBorins
Copy link
Author

MylesBorins commented Jul 24, 2020 via email

@adylevy
Copy link

adylevy commented Jul 28, 2020

Can you just update chokidar? last version use newer version of fsevents which shouldn't have issues with node 12

@phated phated added this to In progress in v5 Oct 22, 2020
@phated phated closed this in #76 May 31, 2023
@phated phated moved this from In progress to Done in v5 May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
v5
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants