If you have neighborhood.cache.duration
set in the .ini
file then when you go to /p/_admin/overview
(or any neighborhood) your changes will not persist. They may appear to show but if you refresh the page they won't be there.
We don't need to worry about clearing/expiring the cache (especially since multi-process multi-server deployments will all have their own memory caches) but we should actually save the changes so that when the cache naturally expires the new values are used.
I can't reproduce this. Maybe there are some other deployment related options which affect this? Can you confirm it still persists?
I had trouble reproducing this too. I first saw it several months ago and couldn't reproduce it locally. Then I encountered it again a few days ago and I was able to reproduce it locally in an environment where
neighborhood.cache.duration
was set.Just now I was able to to reproduce in our production environment on a high-traffic neighborhood. But saving did work ok in a neighborhood that is essentially never used (and thus likely not cached in some/all the procs).
If needed perhaps we could just add some more logging to get more info about what's happening. That is, if we can think of good logging to add :)
Ok, I've got some progress.
I was able to reproduce this locally while running this script to simulate concurrent access to the same neighborhood (
neighborhood.cache.duration
set to 10).My current understanding of the problem is:
NeighborhoodCache._lookup
, which populates cacheneighborhood
object from the cacheSome ad-hoc logging I have added confirms this.
I was not able to fix this yet, though. If someone knows a way to add object to current thread's ming session, or to flush ming object which does not belong to a session (i.e.
session(obj) == None
), please let me know :)On 42c side, I've closed #794 and created #801 for fixing this, since I've underestimated this task initially.
Closed #801.
ib/7890
A simplest fix actually worked. I've just added a line to get neighborhood from mongo to the beginning of "update" controller.
Notes for QA:
python ./scripts/get_neighborhood.py http://<your_host>/p/wiki/Home>
neighborhood.cache.duration
to something small (5 - 10 seconds)On master:
/p/_admin/overview
, change something and submit the formCheckout the branch and repeat the above. After form submission you will not see new values, but after cache expires you should see them.
Last edit: Igor Bondarenko 2015-06-15
Nice work! I like it when the fix is simple too :)