Sorry, don't "Hit" Erik. Say "Hi" to him ;)

On Dec 17, 10:46 am, Tom Phillips <[email protected]> wrote:
> Hit Erik,
>
> From your stack trace, I think you are seeing something else. Have you
> got an explicit serialVersionUID set in the com.WikiHop.jdo.Pi class
> (your key is OK I think) that you are putting into Memcache? And if so
> has it changed at some point? It looks like you may be either trying
> to read out a different class entirely than was inserted into the
> cache,  or have changed or added the serialVersionUID in the value
> class since an entry was inserted and it is now stale.
> serialVersionUID is a way of identifying a class (or "version" of a
> class) to the java serialization framework - if you change it you are
> telling it that it is effectively no longer compatible for
> serialization with previous instances, even if you have change nothing
> else in the class. So it's a good idea to set it early, and never
> change it for a class unless you have a good reason to invalidate
> older serialized entries.
>
> I'm not having any problems reading values out of the cache. The
> problem I'm seeing is that the entire entry can only be found if it
> was inserted by the same JVM (or "instance') that inserted it. A
> scoping problem where it appears to be less global than it should be.
>
> You may want to start a separate thread on your issue if you are still
> seeing it and the above doesn't shed any light on it.
>
> Thanks,
> Tom
>
> On Dec 17, 4:11 am, Erik <[email protected]> wrote:
>
> > Missed some more errors:
>
> > Caused by: java.io.InvalidClassException: com.WikiHop.jdo.Pi; local
> > class incompatible: stream classdesc serialVersionUID =
> > -6007756724690804603, local class serialVersionUID = -1398789866
> >         at 
> > java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:579)
> >         at 
> > java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:
> > 1600)
> >         at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:
> > 1513)
> >         at
> > java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:
> > 1749)
> >         at 
> > java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
> >         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
> >         at
> > com.google.appengine.api.memcache.MemcacheSerialization.deserialize(MemcacheSerialization.java:
> > 163)
> >         at
> > com.google.appengine.api.memcache.MemcacheServiceImpl.get(MemcacheServiceImpl.java:
> > 283)
> >         ... 43 more
>
> > On Dec 17, 3:56 am, Erik <[email protected]> wrote:
>
> > > Not sure if it is related, but I was getting some interesting memcache
> > > errors that I had to work around:
>
> > > javax.servlet.ServletContext log: Exception while dispatching incoming
> > > RPC call
> > > com.google.gwt.user.server.rpc.UnexpectedException: Service method
> > > 'public abstract java.lang.String
> > > com.WikiHop.client.SearchPath.find(java.lang.String,java.lang.String)
> > > throws java.lang.IllegalArgumentException' threw an unexpected
> > > exception: com.google.appengine.api.memcache.InvalidValueException: IO
> > > exception parsing value of '3434143'
> > >         at
> > > com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
> > > 378)
> > >  ...
> > > Caused by: com.google.appengine.api.memcache.InvalidValueException: IO
> > > exception parsing value of '3434143'
> > >         at
> > > com.google.appengine.api.memcache.MemcacheServiceImpl.get(MemcacheServiceImpl.java:
> > > 289)
> > >         at
> > > com.google.appengine.api.memcache.jsr107cache.GCache.get(GCache.java:
> > > 166)
>
> > > On Dec 16, 2:53 pm, Tom Phillips <[email protected]> wrote:
>
> > > > Certainly Ikai,
>
> > > > Firstly, some of my logs (url and classes slightly modified to hide
> > > > some app details) that show how only the same instance picks up the
> > > > entry. I'm determining and logging the instance using a UUID that I
> > > > assign to a static class variable. The key for the cache lookup is
> > > > passed in as a request query parameter to the followup requests.
>
> > > > Here are two runs of the code to follow. In each, the bottom log is
> > > > the cache entry being added. The next two are subsequent requests that
> > > > both look for the entry. The entry is only found when then instance
> > > > matches, regardless of which follow-up request.
>
> > > > This first run shows how the bottom instance is different from the one
> > > > that services both followup requests. So they don't find the entry:
>
> > > > 50.16.21.20 - - [16/Dec/2010:11:19:40 -0800] "GET /processg?key=619001
> > > > W 12-16 11:19AM 40.373 com.mycode.CallProcessGatherServlet doGet:
> > > > LOOKING IN CACHE on Instance: b7c866f2-d74b-45df-9993-1d2c4705d3d1
> > > > W 12-16 11:19AM 40.373 com.mycode.CallProcessGatherServlet doGet:
> > > > Message NOT found in cache for 619001 - building
>
> > > > 50.16.21.20 - - [16/Dec/2010:11:19:35 -0800] "POST /startreminder?
> > > > key=619001&pname=Optimal+Physio+Dev&atime=Friday+December+17%2C
> > > > +2%3A18+PM&rlang=en&rvoice=woman
> > > > W 12-16 11:19AM 33.173 com.mycode.CallMLServlet doGet: LOOKING IN
> > > > CACHE on Instance: b7c866f2-d74b-45df-9993-1d2c4705d3d1
> > > > W 12-16 11:19AM 33.173 com.mycode.CallMLServlet doGet: Message NOT
> > > > found in cache for 619001 - building
>
> > > > 0.1.0.2 - - [16/Dec/2010:11:19:08 -0800] "POST /tasks/voicereminder
> > > > HTTP/1.1" 200 105 "http://cliniconexdev.appspot.com/cron/
> > > > processreminders?state=new"
> > > > W 12-16 11:19AM 08.581 com.mycode.CallPhoneAdapter doSend: CACHING
> > > > message from instance: e4d5452e-c744-4333-b1d4-38eb55f97445
> > > > W 12-16 11:19AM 08.585 com.mycode.CallPhoneAdapter doSend: Adding to
> > > > cache with key:619001
> > > > W 12-16 11:19AM 08.604 com.mycode.CallPhoneAdapter doSend:
> > > > Successfully cached reminder 619001
>
> > > > In this second run, the first followup request hits the same instance
> > > > that added it, and finds it. The second isn't so lucky, hitting a
> > > > different instance
>
> > > > 184.73.13.122 - - [16/Dec/2010:11:22:39 -0800] "GET /processg?
> > > > key=620001
> > > > W 12-16 11:22AM 38.782 com.mycode.CallProcessGatherServlet doGet:
> > > > LOOKING IN CACHE on Instance: ff6ef71c-a017-4316-aa81-e77db741702b
> > > > W 12-16 11:22AM 38.782 com.mycode.CallProcessGatherServlet doGet:
> > > > Message NOT found in cache for 620001 - building
>
> > > > 204.236.222.67 - - [16/Dec/2010:11:22:28 -0800] "POST /startreminder?
> > > > key=620001&pname=Optimal+Physio+Dev&atime=Friday+December+17%2C
> > > > +2%3A18+PM&rlang=en&rvoice=woman HTTP/1.1" 200 683 -
> > > > "CallProxy/0.7,gzip(gfe)" "cliniconexdev.appspot.com" ms=24 cpu_ms=23
> > > > api_cpu_ms=0 cpm_usd=0.000805
> > > > W 12-16 11:22AM 28.127 com.mycode.CallMLServlet doGet: LOOKING IN
> > > > CACHE on Instance: b7c866f2-d74b-45df-9993-1d2c4705d3d1
> > > > W 12-16 11:22AM 28.134 com.mycode.CallMLServlet doGet: Message for
> > > > entry 620001 FOUND in cache - using
>
> > > > 0.1.0.2 - - [16/Dec/2010:11:22:06 -0800] "POST /tasks/voicereminder
> > > > HTTP/1.1" 200 105 "http://cliniconexdev.appspot.com/cron/
> > > > processreminders?state=new" "AppEngine-Google;
> > > > (+http://code.google.com/appengine)" "cliniconexdev.appspot.com"
> > > > ms=506 cpu_ms=1664 api_cpu_ms=941 cpm_usd=0.046287 queue_name=reminder-
> > > > queue task_name=17196018701084092971
> > > > W 12-16 11:22AM 05.964 com.mycode.CallPhoneAdapter doSend: CACHING
> > > > message from instance: b7c866f2-d74b-45df-9993-1d2c4705d3d1
> > > > W 12-16 11:22AM 05.965 com.mycode.CallPhoneAdapter doSend: Adding to
> > > > cache with key:620001
> > > > W 12-16 11:22AM 05.984 com.mycode.CallPhoneAdapter doSend:
> > > > Successfully cached reminder 620001
>
> > > > Here is the code that creates the cache (if required) and adds the
> > > > entry in the first request:
> > > > Cache cache = null;
>
> > > > log.warning("CACHING message from instance: " + jvmId);
>
> > > > try {
> > > >    cache = CacheManager.getInstance().getCache("cache_reminderVoice");
> > > >  } catch (final Exception e) {
> > > >     log.fine("Cache cache_reminderVoice not yet created");
>
> > > > }
>
> > > > if (cache == null) {
> > > >   try {
> > > >      cache = CacheManager.getInstance().getCacheFactory()
> > > >             .createCache(Collections.emptyMap());
> > > >      CacheManager.getInstance().registerCache("cache_reminderVoice",
> > > > cache);
> > > >   } catch (final CacheException e) {
> > > >         log.warning("Could not create/register cache
> > > > cache_reminderVoice: "
> > > >             + e.getMessage());
> > > >   }
>
> > > > }
>
> > > > try {
> > > >       // Put the value into the cache.
> > > >    log.warning("Adding to cache with key:" +
> > > > reminder.getKeyId().toString());
> > > >    if (parts == null) {
> > > >       log.warning("Hmmmm..parts was null");
> > > >    }
> > > >    cache.put(reminder.getKeyId().toString(), parts);
>
> > > >    // Get the value from the cache just to test it is there
> > > >    final CacheEntry entry = cache.getCacheEntry(reminder.getKeyId()
> > > >           .toString());
> > > >    if (entry != null) {
> > > >         log.warning("Successfully cached reminder " +
> > > > reminder.getKeyId());
> > > >    } else {
> > > >         log.warning("Could not get cached voice message parts");
> > > >     }
> > > >  } catch (final Exception e) {
> > > >       log.warning("FAILED to cache voice message parts: " +
> > > > e.getMessage());
> > > >  }
>
> > > > Here is the code (same in both request handlers) that retrieves the
> > > > entry from the cache:
>
> > > > Cache cache = null;
>
> > > >  log.warning("LOOKING IN CACHE on Instance: " +
> > > > TwilioPhoneAdapter.jvmId);
>
> > > >  try {
> > > >         cache =
> > > > CacheManager.getInstance().getCache("cache_reminderVoice");
> > > >         if (cache != null) {
> > > >           parts = (VoiceParts) cache.get(key);
> > > >         }
> > > >         if (parts != null) {
> > > >           log.warning("Message for entry
>
> ...
>
> read more »

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to