Reputation: 41
I’m currently part of a team migrating a Python 2.7 app engine application to Python 3.9, and I am having a great deal of difficulty with implementing the legacy memcache bundled service. I’m hoping someone with experience with this might be able to help please. Whenever our application attempts to call any of the memcache methods, we are constantly getting the same exception - “RPCFailedError: Attempted RPC call without active security ticket”. We have researched this error widely across the web, and have tried everything under the sun to try to correct this, but to no avail.
Our application uses the Bottle framework, and our app is is initialised using the following code:
app = bottle.default_app()
app.config.update({'catchall': False})
app = google.appengine.api.wrap_wsgi_app(app, use_legacy_context_mode=True, use_deferred=False)
I have found that the RPCFailedError is raised within the _MakeCallImpl function within the default_api_stub.py file of the Python AppEngine Runtime code, but there are couple of things we still don’t understand:
Because our application uses NDB extensively, it was decided to create a global context by wrapping the entire request cycle as suggested in this Stack overflow post. In our case we did this through the call dunder method of the Bottle class.
def __call__(self, environ, start_response):
""" Each instance of :class:'Bottle' is a WSGI application. """
with self.ndb_client.context():
return self.wsgi(environ, start_response)
I hope this summarizes our situation and findings most accurately, and any clues would be greatly appreciated. In fact, if you really do help me out, and we get our application running, then I will mail you a copy of a board game for free - wherever you are on the planet!
To fix this issue we have tried to ensure that all code is running on the same thread, but we are not 100% sure that the GAE cloud environment is doing something different to our local development environments (which don’t work either btw).
I’ve also tried to replace memcache altogether but that just has its own set of issues and errors, and since we are also getting the same RPCFailedError for the “deferred” legacy service, we decided to stick with memcache for now.
We’ve also tried this Chromium patch, as detailed here, but it made no difference. Neither did a whole bunch of other changes indicated by the meagre set of similar posts about this problem that we could find on the web, but nothing has worked, or doesn’t really address our particular problem.
If nothing else then thanks for reading this far.
Upvotes: 0
Views: 72