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

watchDir misses some Git events, watchTree shows them all on Linux #97

Open
mgajda opened this issue Oct 19, 2020 · 6 comments
Open

watchDir misses some Git events, watchTree shows them all on Linux #97

mgajda opened this issue Oct 19, 2020 · 6 comments

Comments

@mgajda
Copy link

mgajda commented Oct 19, 2020

I have been playing with a minimal script to show all events on the directory tree:

{-# LANGUAGE ScopedTypeVariables #-}
module Main where

import Control.Monad(forever)
import Control.Concurrent
import Control.Concurrent.Chan as Chan
import System.FSNotify

main = do
  evtChan <- Chan.newChan
  forkIO $ forever $ readChan evtChan >>= print
  withManagerConf (defaultConfig { confDebounce = NoDebounce
                                 , confUsePolling = False }) $ \mgr -> do
    System.FSNotify.watchDirChan mgr "." (const True) evtChan
    threadDelay 10000000000

This script misses some of the file changes when executing git checkout HEAD~1 on a repo with multiple files changed per patch.

The same thing happens for watchDir and watchDirChan, but replacing with watchTree or watchTreeChan fixes the issue.

This issue caused another in enTangled.

@mgajda mgajda changed the title watchDir misses some Git events, watchDirTree shows them all on Linux watchDir misses some Git events, watchTree shows them all on Linux Oct 19, 2020
@thomasjm
Copy link
Contributor

Not sure I understand -- watchDir/watchDirChan are the non-recursive versions, so it's expected that they'll miss events in subdirectories, if that's what's happening.

Can you provide a complete repro showing the problem?

@mgajda
Copy link
Author

mgajda commented Oct 21, 2020

These are events in the same directory, not subdirectories.

@mgajda
Copy link
Author

mgajda commented Oct 21, 2020

Complete repro is in entangled repo: entangled/entangled#80 (comment)
Since similar issue seems to occur with confPolling = True on Ubuntu 20.04, I will investigate more carefully, and hopefully then we can copy complete repro script here.

@thomasjm
Copy link
Contributor

Okay, I'll wait for the repro script to look deeply into this.

As many details as you could provide would be helpful, such as the event types and order of events that causes the problem.

You might also want to make sure confUsePolling = False, since polling can definitely miss events--for example, if a file is quickly created and then deleted in between polls. (There seems to be some confusion about whether polling is enabled in the linked discussion.)

@mgajda
Copy link
Author

mgajda commented Oct 30, 2020

@thomasjm Our test only aims for eventual consistency, so it is the situation where file is changed and not reported at all that seems most concerning.

@thomasjm
Copy link
Contributor

thomasjm commented Nov 2, 2020

@mgajda sounds good -- I'm ready to look at a simple repro script anytime.

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

2 participants