From 3585c2c38955ece4292da77de7173fb31a6992ba Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 29 Jan 2021 18:58:14 +0000 Subject: [FIX] registry: prevent inherited phantom cache clears This patch complements the previous one by ensuring that any `cache_invalidated=True` flag inherited from the master process (pre-fork mode) cannot trigger a cache clear. This could occur when the first request is served, because the flag was never clear in the master process, which never server any request. At the end of `check_signaling()`, the local cache has either been cleared because a (real) increment of the cache sequence was detected, or it is considered still valid. The final state of the `cache_invalidated` flag should reflect this, by being `False`. closes odoo/odoo#65303 Signed-off-by: Raphael Collet (rco) --- odoo/modules/registry.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'odoo') diff --git a/odoo/modules/registry.py b/odoo/modules/registry.py index 3397ab407ed..c9e0497637a 100644 --- a/odoo/modules/registry.py +++ b/odoo/modules/registry.py @@ -601,7 +601,11 @@ class Registry(Mapping): elif self.cache_sequence != c: _logger.info("Invalidating all model caches after database signaling.") self.clear_caches() - self.cache_invalidated = False + + # prevent re-signaling the clear_caches() above, or any residual one that + # would be inherited from the master process (first request in pre-fork mode) + self.cache_invalidated = False + self.registry_sequence = r self.cache_sequence = c -- cgit v1.2.3