From ac5ba4a2b0ab75a42d86a5aa04a0e837de64ffff Mon Sep 17 00:00:00 2001 From: Adrian Torres Date: Mon, 27 Nov 2017 11:12:27 +0100 Subject: [PATCH] [FIX] server: do not restart if phoenix is True (#21209) Before this commit, saving a file being watched by watchdog (--dev=reload) with vim (and possibly other text editors) would crash the server via a KeyboardInterrupt error. This happens because vim, emacs cause multiple filesystem events to happen when saving a single file, the FSWatcher registers these events as multiple SIGHUPs which in turn calls restart() multiple times in a very small amount of time which makes the KeyboardInterrupts completely shut down the server This is fixed by only calling restart() if odoo.phoenix is False, since catching a SIGHUP sets it to true. Fixes #21178 Special thanks to @odony for the help :) --- odoo/service/server.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/odoo/service/server.py b/odoo/service/server.py index 835ecd3b27a..000fe096250 100644 --- a/odoo/service/server.py +++ b/odoo/service/server.py @@ -140,8 +140,9 @@ class FSWatcher(object): except SyntaxError: _logger.error('autoreload: python code change detected, SyntaxError in %s', path) else: - _logger.info('autoreload: python code updated, autoreload activated') - restart() + if not getattr(odoo, 'phoenix', False): + _logger.info('autoreload: python code updated, autoreload activated') + restart() def start(self): self.observer.start()