#28342: PyLibMCCache throwing exceptions when memcached server is down
-------------------------------------+-------------------------------------
Reporter: Julian | Owner: nobody
Andrews |
Type: Bug | Status: new
Component: Core | Version: 1.11
(Cache system) | Keywords: memcached cache
Severity: Normal | pylibmc
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
If your memcached server is down, pylibmc will raise a
`pylibmc.ConnectionError` or `pylibmc.ServerDown` exception for all
operations. This is different from the behavior of the `python-memcached`
package (see http://sendapatch.se/projects/pylibmc/misc.html). However,
the `PyLibMCCache` cache backend does nothing to catch these errors. As a
result, the behavior is different from the `MemcachedCache` backend which
fails silently.
This behavior is particularly problematic for fragment caches which
obviously shouldn't raise an exception. In any case, it seems pretty clear
that both backends should have the same behavior.
----
Steps to reproduce:
1. Setup a Django app `CACHES` set to use `PyLibMCCache`:
{{{
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
'LOCATION': '127.0.0.1:11211',
}
}
}}}
2. With no active memcached server open a shell and run:
{{{
from django.core.cache import cache
cache.get('foo')
}}}
`pylibmc` will raise an exception. Using `MemcachedCache`, `cache.get`
will instead return `None`.
--
Ticket URL: <https://code.djangoproject.com/ticket/28342>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/056.cb8826f64026c40fd15cb4f51f2c685d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.