Opened 14 years ago

Closed 12 years ago

#15729 closed Bug (needsinfo)

Cache middleware issues after restart when using mod_wsgi with PyLibMC

Reported by: Jim Dalton Owned by: nobody
Component: Core (Cache system) Version: 1.3
Severity: Normal Keywords:
Cc: oliver@… Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm running into a cache error using the PyLibMC cache backend in conjunction with mod_wsgi.

I have a strong feeling it's related to #15655 and is probably an issue for the pylibmc maintainers and not Django. I do feel, however, that the issue is worth reporting here because it is occurring on a pretty standard installation with the recommended web server (mod_wsgi). It also makes me wonder whether more robust error handling might need to be built into the PyLibMC backend to account for ways things could go wrong.

So, the gist of the problem: I have memcached running on a separate server and PyLibMC as the memcached backend. Things work great...until I restart memcached. After doing so I get the following traceback:

Traceback (most recent call last):

File "/var/www/****/src/django/django/core/handlers/base.py", line 89, in get_response
  response = middleware_method(request)
File "/var/www/*****/src/django/django/middleware/cache.py", line 143, in process_request
  cache_key = get_cache_key(request, self.key_prefix, 'GET', cache=self.cache)
File "/var/www/*****/src/django/django/utils/cache.py", line 190, in get_cache_key
  headerlist = cache.get(cache_key, None)
File "/var/www/*****/src/django/django/core/cache/backends/memcached.py", line 58, in get
  val = self._cache.get(key)
UnknownReadFailure: error 7 from memcached_get: UNKNOWN READ FAILURE

Restarting Apache resolved this error.

The issue does not occur when using MemcachedCache backend.

Change History (7)

comment:1 by Luke Plant, 14 years ago

Type: Bug

comment:2 by Luke Plant, 14 years ago

Severity: Normal

comment:3 by Ludvig Ericson, 14 years ago

It's actually not even a fault pylibmc can handle - the underlying libmemcached library should be handling this. There are patches floating around the internet regarding libmemcached's handling of failures but I would suggest pushing for this issue on the libmemcached mailing list.

Version 0, edited 14 years ago by Ludvig Ericson (next)

in reply to:  3 comment:4 by Jim Dalton, 14 years ago

Replying to toxik:

It's actually not even a fault pylibmc can handle - the underlying libmemcached library should be handling this. There are patches floating around the internet regarding libmemcached's handling of failures but I would suggest pushing for this issue on the libmemcached mailing list.

Yeah, I don't know. I guess I just feel like if you're deploying on a stack that's "recommended" by the official Django documentation and a failry typical action within that stack (restarting memcached service) causes an application error within Django that literally brings your application to a halt, then that's perhaps something that should at least be mentioned in the documentation? I mean, I saw the addition of PyLibMC and had heard good things about it, and went through the trouble of configuring and deploying it, and only very fortunately caught the issue while it was still staging so that it did not make it production. It seems like a huge red flag to using the library.

But I completely understand your line of reasoning. It's not something it would appear Django can do anything about directly, but by the same token should that library be supported?

comment:5 by Jacob, 14 years ago

Easy pickings: unset
Triage Stage: UnreviewedDesign decision needed

Is it possible for us to work around this in a non-nasty way? Otherwise I think we just have to document it and hope the pylibmc/libmemcached folks fix their stuff.

comment:6 by Oliver Beattie, 13 years ago

Cc: oliver@… added
UI/UX: unset

Has it actually been brought to the attention of the pylibmc/libmemcached folks?

comment:7 by Aymeric Augustin, 12 years ago

Resolution: needsinfo
Status: newclosed

There's more questions than answers on this ticket... If you want to advance this bug, get feedback from the pylibmc maintainers, and suggest a workaround.

Note: See TracTickets for help on using tickets.
Back to Top