summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabien Meghazi <fme@odoo.com>2021-05-25 15:19:24 +0000
committerFabien Meghazi <fme@odoo.com>2021-05-26 16:35:51 +0000
commite5bd37808e023e17a819de277c50d03825c44191 (patch)
treef1f0784ff2b89195f3aaaa77efe23f27d740b54f
parent79d3cf453779c83cab63345a934c3fa83b6b2de0 (diff)
[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#71284 X-original-commit: 8703ff1e3d9be6f2f5fce2e8c4e62589b05133fb Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
-rw-r--r--odoo/service/server.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/odoo/service/server.py b/odoo/service/server.py
index cff0a3f8896..6a52f46ef3d 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
#----------------------------------------------------------