Closed GoogleCodeExporter closed 9 years ago
Forgot to mention, that each thread uses it's own ofy instance.
Could this issue also affect separate requests? For example:
1. Request A is handled in thread x, loads an entity
2. Request B is handled in thread y, loads, updates, and saves the entity
3. Request C is handled in thread x, loads the entity
The requests are strictly serial, called subsequently by the client.
--> Which entity instance is expected to be loaded in Request C? The outdated
one from request A?
This would explain an issue we're having currently in this request scenario. If
that's the case, a ServletFilter calling ofy.clear() would probably help.
Original comment by mar...@greenrobot.de
on 13 Aug 2013 at 8:16
Sounds like you don't have the ObjectifyFilter installed?
https://code.google.com/p/objectify-appengine/wiki/Setup#Enable_ObjectifyFilter_
for_your_requests
https://code.google.com/p/objectify-appengine/wiki/FrequentlyAskedQuestions#Stra
nge_things_are_showing_up_in_my_session_cache!
Original comment by lhori...@gmail.com
on 13 Aug 2013 at 8:33
Right, we forgot the ObjectifyFilter; thanks for reminding us of the obvious...
Nevertheless, do you any plans to support multithreading within a single
request? It's probably not high priority, but some more notes on multi
threading in the docs might help others. Thanks again...
For https://code.google.com/p/objectify-appengine/wiki/Caching, I'm not sure if
the following sentence is still valid: "When you enter a transaction context,
you receive a fresh, empty session cache." In my tests, I got stale entities
from within a transaction, if I remember correctly.
Original comment by mar...@greenrobot.de
on 13 Aug 2013 at 9:24
There are no plans to support threading a single Objectify instance. It may not
be possible; the underlying DatastoreService is not officially thread-safe. It
would also add a lot of complexity.
That sentence is still valid. I would be very surprised if you can find
contrary behavior - be careful in tests because you have to demarcate a
"request" on your own (there's no ObjectifyFilter). Call
ObjectifyFilter.complete() on your own between what ever demarcates a separate
"request" in your test cases.
Original comment by lhori...@gmail.com
on 16 Aug 2013 at 2:22
Original issue reported on code.google.com by
mar...@greenrobot.de
on 13 Aug 2013 at 8:01