gorakhargosh / watchdog

Python library and shell utilities to monitor filesystem events.
http://packages.python.org/watchdog/
Apache License 2.0
6.58k stars 694 forks source link

weird modify detection after upgrade to new Window 10 20H1 #667

Open tsabi opened 4 years ago

tsabi commented 4 years ago

Hi, i develop in Odoo ERP, and it uses watchdog to detect source code update for automatic server restart. After i upgraded to Windows 10 20H1 (v2004) the Odoo server constantly restarts itserv because false detection of file modification of random files. (of course i tried restart, disable virus scanner, nothing changed.) I use the latest version of watchdog installed via pip with python 3.8.3.

The Odoo server runs this way the watchdog process:

import watchdog
from watchdog.observers import Observer
from watchdog.events import FileCreatedEvent, FileModifiedEvent, FileMovedEvent

class FSWatcherWatchdog(FSWatcherBase):
    def __init__(self):
        self.observer = Observer()
        for path in odoo.addons.__path__:
            _logger.info('Watching addons folder %s', path)
            self.observer.schedule(self, path, recursive=True)

    def dispatch(self, event):
        if isinstance(event, (FileCreatedEvent, FileModifiedEvent, FileMovedEvent)):
            if not event.is_directory:
                path = getattr(event, 'dest_path', event.src_path)
                self.handle_file(path)

    def start(self):
        self.observer.start()
        _logger.info('AutoReload watcher running with watchdog')

    def stop(self):
        self.observer.stop()
        self.observer.join()

Can you help me how to debug or fix this, please? Actually this is a huge stepback for me, i always need to manually restart the server process, what is so annoying and time waste..

projekt01 commented 4 years ago

Same here, I can confirm that the observer get triggered after windows startup with the newest windows release. I did't find time to debug my app. Any hints on this?

BoboTiG commented 3 years ago

Could you retry with the master branch and let me know if the issue is still present please?