So, lately, I have noticed some really inconsistent behavior in Objectify.
Sometimes my entities would be fetched modified, and sometimes, event several minutes after modification, I kept getting an unmodified version.
I checked and here is the problem : Appengine now recycles it's thread, meaning that 2 requests can be done on the same thread sequentially since the thread is not recreated anymore. Maybe it's not new and maybe they changed something else, but the result is that ThreadLocal is NOT local to a REQUEST anymore. It's local to a THREAD and re-used across requests.
(BTW, yes I have <threadsafe>true</threadsafe> in appengine-web.xml)
This is really problematic if you have multiple app engine instances running due to the session cache that is always reused and never considered invalid (and therefore de-synchronized among instances).
I found the problem when I noticed that I kept getting the same objectify object on each of my instances in production (not in development).
In sources, the problem is that, since it's the same thread doing multiple requests sequentially, ObjectifyService.STACK is not renewed, and it's always the same objectify object with the same session cache that is used.
So I used a very simple fix : in AsyncCacheFilter, line 72, I added ObjectifyService.reset();
And that solved the problem since ObjectifyService.STACK is now cleared at the end of each request.
I think that this fix should be on main sources. However, this fix makes AsyncCacheFilter mandatory EVEN for apps that do not use objectify global cache.
Bien cordialement,
Salomon BRYS