google-code-export / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
1 stars 0 forks source link

NPE on LiveRef.get() when referenced object is deleted #165

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I think this happens when i call Ref.get() on an object and the referenced 
object has been deleted by an other transaction. It is hard to reproduce.... 
but i get it sometimes.
2.
3.

What is the expected output? What do you see instead?
I would expect the "old" object even though it was deleted. Otherwise null.

What version of the product are you using? On what operating system?
4.0rc1

Please provide any additional information below.

java.lang.NullPointerException
    at com.googlecode.objectify.impl.Round$1.nowUncached(Round.java:73)
    at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:30)
    at com.googlecode.objectify.impl.LoaderImpl.now(LoaderImpl.java:249)
    at com.googlecode.objectify.impl.ref.LiveRef.get(LiveRef.java:47)

Original issue reported on code.google.com by jens.sch...@gmail.com on 21 Jun 2013 at 2:10

GoogleCodeExporter commented 9 years ago
I should mention that the ref that fails is loaded by @Load.

Original comment by jens.sch...@gmail.com on 21 Jun 2013 at 2:24

GoogleCodeExporter commented 9 years ago
This is "as designed" - Ref<?>s are references to the session (and datastore), 
not actual holders of the object. If you delete the referenced entity within 
the session, this change will be reflected in all Ref<?>s.

I'm interpreting this as a "fix in documentation" issue, updated here (see the 
"Additional Ref<?> Considerations":

https://code.google.com/p/objectify-appengine/wiki/Entities#Ref<?>_s

Original comment by lhori...@gmail.com on 21 Jun 2013 at 2:36

GoogleCodeExporter commented 9 years ago
Here is a full trace. this seems to happen when the gae is off ad turned on for 
the first request

java.lang.NullPointerException
    at com.googlecode.objectify.impl.Round$1.nowUncached(Round.java:73)
    at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:30)
    at com.googlecode.objectify.util.ResultNowFunction.apply(ResultNowFunction.java:20)
    at com.googlecode.objectify.util.ResultNowFunction.apply(ResultNowFunction.java:9)
    at com.google.common.collect.Iterators$8.transform(Iterators.java:860)
    at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
    at com.googlecode.objectify.impl.Chunk.next(Chunk.java:27)
    at com.googlecode.objectify.impl.Chunk.next(Chunk.java:10)
    at com.google.common.collect.Iterators$5.next(Iterators.java:607)
    at com.google.common.collect.Iterators$PeekingImpl.peek(Iterators.java:1239)
    at com.googlecode.objectify.impl.ChunkingIterator.hasNext(ChunkingIterator.java:52)
    at com.google.common.collect.Lists.newArrayList(Lists.java:144)
    at com.google.common.collect.Lists.newArrayList(Lists.java:125)
    at com.googlecode.objectify.util.MakeListResult.translate(MakeListResult.java:21)
    at com.googlecode.objectify.util.MakeListResult.translate(MakeListResult.java:11)
    at com.googlecode.objectify.util.ResultTranslator.nowUncached(ResultTranslator.java:21)
    at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:30)
    at com.googlecode.objectify.util.ResultProxy.invoke(ResultProxy.java:34)
    at com.sun.proxy.$Proxy21.iterator(Unknown Source)
    at java.util.Collections$UnmodifiableCollection$1.<init>(Collections.java:1064)
    at java.util.Collections$UnmodifiableCollection.iterator(Collections.java:1063)
    at flexjson.transformer.IterableTransformer.transform(IterableTransformer.java:26)

Original comment by 1vue...@gmail.com on 4 Sep 2014 at 5:40