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

PollingObserver misses some new files when previously seen files are removed #992

Open
smola opened this issue Jun 29, 2023 · 1 comment

Comments

@smola
Copy link

smola commented Jun 29, 2023

I'm observing missing events for newly created files in the following scenario:

  • Process 1 is creating files in a directory.
  • Process 2 is observing the directory with PollingObserver, whenever it sees file X, it creates X.processed and removes X.
  • Tested on Linux with ext4.

Here's a gist with code to reproduce the issue: https://gist.github.com/smola/d40614a9b546a650d87bc3588efc1014

Apparently, under these fast create/deletes, the operating system is reusing inodes for new files, and they are being detected as file moves, rather than creations:

for path in set(created):
inode = snapshot.inode(path)
old_path = ref.path(inode)
if old_path:
created.remove(path)
moved.add((old_path, path))

However, the moves are arbitrary. For example, it detects a move from 87 to 83.processed. A possible workaround is looking for creation, modified events, and also moves (with dest_path in this case).

@smola
Copy link
Author

smola commented Jun 30, 2023

I realize that that the problem of distinguishing remove/create with reused inodes vs file move is simply not solvable. But it seems something else is off in this scenario, where file modified events are also created for all files that were already deleted.

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

No branches or pull requests

1 participant