Skip to content

Commit

Permalink
[FIX] registry: prevent inherited phantom cache clears
Browse files Browse the repository at this point in the history
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#65346

X-original-commit: 3585c2c
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
  • Loading branch information
odony committed Feb 1, 2021
1 parent 654052d commit 12225d5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion odoo/modules/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,11 @@ def check_signaling(self):
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

Expand Down

0 comments on commit 12225d5

Please sign in to comment.