From 24b8a6178df3cb930bb3a2fee9f370c15a18eb3a Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 25 May 2021 15:19:24 +0000 Subject: [PATCH] [FIX] server: prevent inotify watches leak Before this commit the PyInotify filesystem watcher used by the code autoreload feature (`--dev=reload`) would not get a chance to free it's inotify watches before the reexec, hence at each reexec triggered by a code reload the inotify watches where accumulated until potentially reaching the kernel limit `fs.inotify.max_user_watches`. This patch ensures that inotify properly closes it's file descriptor before we reexec: https://github.com/dsoprea/PyInotify/blob/f77596a/inotify/adapters.py#L79 closes odoo/odoo#71302 X-original-commit: 8703ff1e3d9be6f2f5fce2e8c4e62589b05133fb Signed-off-by: Raphael Collet (rco) --- odoo/service/server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/odoo/service/server.py b/odoo/service/server.py index 93006359600..a6f86dae891 100644 --- a/odoo/service/server.py +++ b/odoo/service/server.py @@ -296,6 +296,7 @@ class FSWatcherInotify(FSWatcherBase): def stop(self): self.started = False self.thread.join() + del self.watcher # ensures inotify watches are freed up before reexec #----------------------------------------------------------