Ok, I've got some progress. 

I was able to reproduce this locally while running [this 
script](https://forge-allura.apache.org/p/allura/pastebin/557ed1556d19cd6c8b87121c)
 to simulate concurrent access to the same neighborhood  
(`neighborhood.cache.duration` set to 10).

My current understanding of the problem is:

1. Some thread misses the cache and executes `NeighborhoodCache._lookup`, which 
populates cache
2. In the "update" thread neighborhood controller gets instantiated with a 
`neighborhood` object from the cache
3. Since it didn't do any neighborhood lookups in the mongo, Ming's session 
does not contain the neighborhood object for the "update" thread
4. When update controller exits, Ming session is flushed to disk, but 
neighborhood object is not, since Ming's session for current thread does not 
contain it.
5. When cache expires, old version of neighborhood object is fetched from the 
mongo and updated values disappear.

Some 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.


---

** [tickets:#7890] Neighborhood cache preventing saving admin changes**

**Status:** in-progress
**Milestone:** unreleased
**Labels:** 42cc 
**Created:** Thu Jun 04, 2015 09:04 PM UTC by Dave Brondsema
**Last Updated:** Tue Jun 09, 2015 05:28 PM UTC
**Owner:** Igor Bondarenko

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.


---

Sent from forge-allura.apache.org because [email protected] is subscribed 
to https://forge-allura.apache.org/p/allura/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://forge-allura.apache.org/p/allura/admin/tickets/options.  Or, if this is 
a mailing list, you can unsubscribe from the mailing list.

Reply via email to