Reputation: 5389
In the last few hours I've started getting exceptions when getting entities by key:
Caused by: java.lang.NullPointerException
at com.google.appengine.api.datastore.PropertyContainer.getProperties(PropertyContainer.java:48)
at com.googlecode.objectify.impl.Transmog.load(Transmog.java:336)
at com.googlecode.objectify.impl.ConcreteEntityMetadata.toObject(ConcreteEntityMetadata.java:203)
at com.googlecode.objectify.impl.AsyncObjectifyImpl$1.wrap(AsyncObjectifyImpl.java:82)
at com.googlecode.objectify.impl.AsyncObjectifyImpl$1.wrap(AsyncObjectifyImpl.java:69)
at com.google.appengine.api.utils.FutureWrapper.wrapAndCache(FutureWrapper.java:57)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:98)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:90)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:90)
at com.googlecode.objectify.impl.ResultAdapter.get(ResultAdapter.java:29)
at com.googlecode.objectify.impl.ObjectifyImpl.get(ObjectifyImpl.java:63)
They are intermittent and are thrown approx 50% of the time.
UPDATE
The second line of code throws the exception:
Objectify ofy = ObjectifyService.begin();
retVal = ofy.get(entityKey);
Adding logging to see the value of entityKey....
UPDATE 2
After adding logging, I can confirm that the Key is non-null and also that when I use the key to get the entity using the datastore viewer it works just fine.
UPDATE 3
I can confirm this is an issue to do with Memcache. After disabling objectify caching, I no longer receive this error. So either this is a bug in objectify (unlikely because I haven't changed/upgraded our objectify library) or the appengine memcache service has changed somehow.
Upvotes: 1
Views: 715
Reputation: 13556
It appears that Google broke serialization/deserialization of the Entity class. They have subsequently rolled back the update that caused the problem and the issue is resolved. Kudos to Alfred, Chris, and the other folks who turned around the problem within a couple hours of hearing about it.
Unfortunately this was not an issue that could be handled by any normal error trapping mechanisms (ie, a serialization exception). The memcache calls succeeded and returned an Entity object, but subsequent calls to getProperties() on the Entity object failed. Nasty bug.
Upvotes: 2
Reputation: 468
Did you declare GAE thread safe in appengine-web-app.xml? The Objectify documentation states:
The session cache is not thread-safe. You should never share an Objectify instance between threads.
http://code.google.com/p/objectify-appengine/wiki/IntroductionToObjectify
Upvotes: -1
Reputation: 9584
Just had the same error.
Flushing the cache corrected it, don't ask why, I don't know but it worked.
I posted a question on the google group of objectify. It's currently under moderation. I hope this weird bug will be understood...
To flush the cache, go to your appengine console > Memcache Viewer > Flush Cache
Upvotes: 0