This repository was archived by the owner on Apr 22, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
fs.watchFile does not detect deletion of unmodified files under certain conditions. #4027
Labels
Comments
Can you post the expected and actual output that you're seeing? I'm under the impression that it WFM. Here is what I see:
Also, on what OS is this? |
oh sorry. I didn't describe the script correctly. There are two files in the script, hello, and hello2.
and hello2 gets
(both with pauses to allow The problem is So, I'm expecting:
But that doesn't happen. I'm on ubuntu 12 |
Thanks, confirmed. Fixed in 39a0836. |
sweet! thanks! |
2 tasks
jBarz
pushed a commit
to ibmruntimes/node
that referenced
this issue
Sep 6, 2017
The sequential/test-regress-GH-4027 test is flaky with an increased system load, failing when the watched file is unlinked before the first state of the watched file is retrieved. After increasing the delay before unlinking and calling setTimeout after watchFile, the flakiness stopped reproducing. PR-URL: nodejs/node#14010 Fixes: nodejs/node#13800 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
# for free
to subscribe to this conversation on GitHub.
Already have an account?
#.
If you
fs.watchFile(file,...)
a newly created flie in the listener of a fs.watchFile on it's parent directory,then delete that file without otherwise modifying it, then that delete will never be noticed.
Here is a script to reproduce:
https://gist.github.com/50ac9170e4615df2b644
first discovered this here
mikeal/watch#36
This bug only strikes when you start watching a new file in response to it's creation (which you detected by watching it's directory). If the file already exists when you start node, (and you start watching it after traversing that directory) then it will be detected correctly.
the deletion can be detected by doing an fs.readdir,
and then comparing that list to what you though you had.
but there is probably a much better way to fix this bug.
The text was updated successfully, but these errors were encountered: