Impacted versions:
tested with 11.0, but I assume all versions that have the autoreload feature

Steps to reproduce:
Start an odoo instance with the --dev=reload argument, and then start editing a python file with emacs while it is watched by odoo for changes.

Current behavior:
As soon emacs creates a lockfile, which is its default behaviour, in the same directory as the edited python file, the odoo instance will log a FileNotFoundError:

    skynet:~/odoo/odoo-git$ ./odoo-bin --addons-path="/home/rakete/odoo/addons,/home/rakete/odoo/odoo-git/odoo/addons,/home/rakete/odoo/odoo-git/addons" --dev=all
    2017-11-24 17:22:00,761 5806 INFO ? odoo: Odoo version 11.0
    2017-11-24 17:22:00,762 5806 INFO ? odoo: addons paths: ['/home/rakete/.local/share/Odoo/addons/11.0', '/home/rakete/odoo/addons', '/home/rakete/odoo/odoo-git/odoo/addons', '/home/rakete/odoo/odoo-git/addons']
    2017-11-24 17:22:00,762 5806 INFO ? odoo: database: default@default:default
    2017-11-24 17:22:00,768 5806 INFO ? odoo.service.server: Watching addons folder /home/rakete/.local/share/Odoo/addons/11.0
    2017-11-24 17:22:00,768 5806 INFO ? odoo.service.server: Watching addons folder /home/rakete/odoo/addons
    2017-11-24 17:22:00,768 5806 INFO ? odoo.service.server: Watching addons folder /home/rakete/odoo/odoo-git/odoo/addons
    2017-11-24 17:22:00,769 5806 INFO ? odoo.service.server: Watching addons folder /home/rakete/odoo/odoo-git/addons
    2017-11-24 17:22:00,830 5806 INFO ? odoo.service.server: AutoReload watcher running
    2017-11-24 17:22:00,830 5806 INFO ? odoo.service.server: HTTP service (werkzeug) running on 0.0.0.0:8069
    2017-11-24 17:22:00,891 5806 INFO ? odoo.addons.base.ir.ir_actions_report: You need Wkhtmltopdf to print a pdf version of the reports.
    Exception in thread Thread-1:
    Traceback (most recent call last):
      File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
        self.run()
      File "/usr/lib/python3/dist-packages/watchdog/observers/api.py", line 199, in run
        self.dispatch_events(self.event_queue, self.timeout)
      File "/usr/lib/python3/dist-packages/watchdog/observers/api.py", line 368, in dispatch_events
        handler.dispatch(event)
      File "/home/rakete/odoo/odoo-git/odoo/service/server.py", line 138, in dispatch
        source = open(path, 'rb').read() + b'\n'
    FileNotFoundError: [Errno 2] No such file or directory: '/home/rakete/odoo/addons/hello_odoo/models/.#models.py'

Afterwards the odoo instance keeps running, but the autoreload feature stops working.

The reason for the FileNotFoundError is probably because what emacs creates as lockfile is not a regular file, but a broken symbolic link:

    skynet:~/odoo$ file addons/hello_odoo/models/.#models.py
    addons/hello_odoo/models/.#models.py: broken symbolic link to rakete@skynet.2238:1511177123
    skynet:~/odoo$

The problem can be worked around in emacs by setting:

    (setq create-lockfiles nil)

Expected behavior:
The autoreload feature should ignore emacs lockfiles, or more generally just ignore broken symbolic links.

""" Preload a registries, possibly run a test file."""
    
    config = odoo.tools.config
    test_file = config['test_file']
    dbnames = dbnames or []
    rc = 0
    for dbname in dbnames:
        try:
            update_module = config['init'] or config['update']
            registry = Registry.new(dbname, update_module=update_module)
            
            if test_file:
                _logger.info('loading test file %s', test_file)
                with odoo.api.Environment.manage():
                    if test_file.endswith('yml'):
                        load_test_file_yml(registry, test_file)
                    elif test_file.endswith('py'):
                        load_test_file_py(registry, test_file)
            if registry._assertion_report.failures:
                rc += 1
        except Exception:
            _logger.critical('Failed to initialize database `%s`.', dbname, exc_info=True)
            return -1
    return rc
def start(preload=None, stop=False):