Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Memcache errors break session-saving. Should fail silently IMO. Any workaround?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Per  
View profile  
 More options Jul 4 2012, 5:38 pm
From: Per <per.fragem...@gmail.com>
Date: Wed, 4 Jul 2012 14:38:34 -0700 (PDT)
Local: Wed, Jul 4 2012 5:38 pm
Subject: Memcache errors break session-saving. Should fail silently IMO. Any workaround?

When using sessions, these are (also) stored in memcache  by GAE.
Unfortunately, it seems like any memcache hiccup can crash the process,
turning an otherwise fine page into a 500 page on the way out.

To me that looks like a design flaw. After all, Memcache is optional, and
its expected to be unavailable or breaking every now and then. As of 1.6
you can even provide a policy to silently ignore memcache errors inside
your application. We're using
setErrorHandler(ErrorHandlers.getConsistentLogAndContinue(Level.SEVERE))
with Objectify just fine, but it doesn't seem to have any effect on the
Session-Save process. This seems to be entirely outside our control.

These errors are really annoying some of our clients. Is there maybe some
kind of other error handler I'm missing?

Here's the stracktrace for reference:

com.google.appengine.api.memcache.MemcacheServiceException: Memcache put: Error setting single item (_ahsOH7nik8bCRTbIXblKurKQQ)
        at com.google.appengine.api.memcache.AsyncMemcacheServiceImpl$7.transform(Asyn cMemcacheServiceImpl.java:426)
        at com.google.appengine.api.memcache.AsyncMemcacheServiceImpl$7.transform(Asyn cMemcacheServiceImpl.java:418)
        at com.google.appengine.api.memcache.MemcacheServiceApiHelper$RpcResponseHandl er.convertResponse(MemcacheServiceApiHelper.java:60)
        at com.google.appengine.api.memcache.MemcacheServiceApiHelper$1.wrap(MemcacheS erviceApiHelper.java:112)
        at com.google.appengine.api.memcache.MemcacheServiceApiHelper$1.wrap(MemcacheS erviceApiHelper.java:105)
        at com.google.appengine.api.utils.FutureWrapper.wrapAndCache(FutureWrapper.jav a: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.memcache.MemcacheServiceImpl.quietGet(MemcacheServ iceImpl.java:28)
        at com.google.appengine.api.memcache.MemcacheServiceImpl.put(MemcacheServiceIm pl.java:81)
        at com.google.apphosting.runtime.jetty.MemcacheSessionStore.saveSession(Memcac heSessionStore.java:39)
        at com.google.apphosting.runtime.jetty.SessionManager$AppEngineSession.save(Se ssionManager.java:164)
        at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionF ilter.java:41)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle r.java:1157)
        at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(Trans actionCleanupFilter.java:43)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle r.java:1157)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
        at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
        at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionH andlerMap.java:249)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:326)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
        at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnecti on.java:923)
        at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequ estParser.java:76)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
        at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceReques t(JettyServletEngineAdapter.java:135)
        at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.j ava:477)
        at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceCont ext.java:449)
        at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.jav a:455)
        at com.google.tracing.TraceContext.runInContext(TraceContext.java:695)
        at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInherited ContextNoUnref(TraceContext.java:333)
        at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInherited Context(TraceContext.java:325)
        at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java: 453)
        at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool .java:251)
        at java.lang.Thread.run(Thread.java:679)

And here's the code I tried, but which didn't help:

        MemcacheService service =
MemcacheServiceFactory.getMemcacheService();
        service.setErrorHandler(new
LogAndContinueErrorHandler(Level.SEVERE));

Any help would be appreciated!

Kind regards,
Per


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joakim  
View profile   Translate to Translated (View Original)
 More options Jul 6 2012, 1:24 pm
From: Joakim <joakim.edenh...@gmail.com>
Date: Fri, 6 Jul 2012 10:24:26 -0700 (PDT)
Local: Fri, Jul 6 2012 1:24 pm
Subject: Re: Memcache errors break session-saving. Should fail silently IMO. Any workaround?

If silent failure on write is to be acceptable, we need a way to make sure
following requests do not read session from memcache, as it could return an
old value. I am unaware of any way to accomplish this reliably without
hitting the datastore, at which point you might as well not have the
session in memcache at all.

One possible alternative is to replace the entire session with storing
encrypted data in a cookie, though this only works for smaller amounts of
data as the maximum size for an entire cookie is generally said to be 4095
bytes.

Just my 2 cents.
Joakim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Per  
View profile   Translate to Translated (View Original)
 More options Jul 9 2012, 1:48 pm
From: Per <per.fragem...@gmail.com>
Date: Mon, 9 Jul 2012 10:48:22 -0700 (PDT)
Local: Mon, Jul 9 2012 1:48 pm
Subject: Re: Memcache errors break session-saving. Should fail silently IMO. Any workaround?

Hi Joakim,

replacing the session with a cookie is unfortunately not an option for us,
our web framework stores a lot of stuff in the session.

I don't even want to use memcache at all, the session ends up in the
datastore anyway, so if I had a choice, I would disable memcache here. It's
just built that way in GAE.  I'd do anything to stop our users from  
getting 500-errors, and I'd like a way to ignore memcache errors here.

I read that the sessions get stored into memcache namespace "_ahs", so I
tried to register a LogAndContinue-Errorhandler for that namespace, but
unfortunately that doesn't work either, at least not this way:

MemcacheServiceFactory.getMemcacheService("_ahs").setErrorHandler(new
LogAndContinueErrorHandler(Level.INFO) {
            @Override
            public void handleDeserializationError(InvalidValueException
thrown) {
                log.error("gotcha!",thrown);
                super.handleDeserializationError(thrown);
            }

            @Override
            public void handleServiceError(MemcacheServiceException thrown)
{
                log.error("gotcha!",thrown);
                super.handleServiceError(thrown);
            }
        });

Any idea how else to register a handler to prevent this from killing our
requests?

Cheers,
Per


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions Older topic »