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

Retain ref to stop #1

Merged
merged 2 commits into from Feb 4, 2021
Merged

Retain ref to stop #1

merged 2 commits into from Feb 4, 2021

Conversation

pipobscure
Copy link
Contributor

You have to retain a reference to the stop function or the watching will be automatically stopped.

pipobscure and others added 2 commits February 4, 2021 21:28
You have to retain a reference to the stop function or the watching will be automatically stopped.
@sunknudsen
Copy link
Owner

Hey @pipobscure,

Thanks again for helping fix this issue.

Unfortunately, I am still experiencing an issue where folders that are usually watched are no longer watched (the issue disappears when I reboot and comes back for no apparent reason).

I have spent considerable time (calculated in days not hours) trying to debug this issue and would love to pick your brain to see if we can figure out what is causing this.

Many people (>75K on Stack Overflow alone) are suffering from this issue which makes coding excruciating when using live reload features.

FYI: it seems OS X can have a folder get corrupted and no longer send fsevents (which watchpack/chokidar/Finder uses) for itself and any child folders. I can't be sure this is what happened to you, but it was very frustrating for me and a colleague.

https://stackoverflow.com/questions/26708205/webpack-watch-isnt-compiling-changed-files

https://stackoverflow.com/questions/6841010/fsevents-mysteriously-fails-to-deliver-events-in-some-folders

Do you have any ideas as to what can cause this? The issue is likely not at the fsevents level, but solving this would mean a lot to me and others.

Thanks!

@pipobscure
Copy link
Contributor Author

@sunknudsen thanks for letting me know. As soon as I have a minute tonight, I’ll create a test on a hosted OSX machine that watches a folder and then on a timer changes files in it and receives the corresponding fsevents. I’ll then let that run for as long as it takes. I hope this can reproduce the issue and then take a status of what’s happened when it does. So let’s see what that does.

The only thing I can think of that would stop listening is when the stop function goes out of scope and is garbage collected. Because the stop function holds the reference to the listener which the. also gets garbage collected. And if that happens then cleanup will stop the listening and free associated memory.

But I’ll try to verify this as described above. (Give it a few days though since I expect this to have to run for quite a while before happening in a reproducible manner.)

@pipobscure pipobscure deleted the patch-1 branch February 16, 2021 13:57
@sunknudsen
Copy link
Owner

@pipobscure thanks so much for helping out. 🤩

I was able to consistently reproduce the issue using my-app/fsevents-issue which essentially is a default create-react-app install with as little code as possible to trigger this issue (see steps).

I really don't now how to troubleshoot this issue more with my limited understanding of what's going on under the hood.

Let me know if I can help.

@sunknudsen
Copy link
Owner

@pipobscure did you manage to find time to run experiments?

@sunknudsen
Copy link
Owner

@pipobscure Perhaps this issue got off your radar... I could really use a hand to troubleshoot the above. 🤞

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.

None yet

2 participants