After a yum update on the server, a django webapp suddenly started to throw 500 internal server errors of each request. This was found in the log file.
Traceback (most recent call last):
File "/usr/local/virtualenv-django19/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 123, in get_response
response = middleware_method(request)
File "/usr/local/virtualenv-django19/local/lib/python2.7/site-packages/django/contrib/sessions/middleware.py", line 16, in process_request
request.session = self.SessionStore(session_key)
File "/usr/local/virtualenv-django19/local/lib/python2.7/site-packages/django/contrib/sessions/backends/cached_db.py", line 24, in __init__
self._cache = caches[settings.SESSION_CACHE_ALIAS]
File "/usr/local/virtualenv-django19/local/lib/python2.7/site-packages/django/core/cache/__init__.py", line 80, in __getitem__
cache = _create_cache(alias)
File "/usr/local/virtualenv-django19/local/lib/python2.7/site-packages/django/core/cache/__init__.py", line 55, in _create_cache
return backend_cls(location, params)
File "/usr/local/virtualenv-django19/local/lib/python2.7/site-packages/django/core/cache/backends/memcached.py", line 174, in __init__
File "/usr/local/virtualenv-django19/local/lib/python2.7/site-packages/pylibmc/__init__.py", line 71, in <module>
ImportError: libmemcached.so.10: cannot open shared object file: No such file or directory
Replace pylibmc with python-memcached.
Pylibmc is said to have better performance than python-memcached but the difference is slight. pylibmc 1.5.1 does not seem to be compatible with libmemcached 1.0.16. Making the change is quite easy. Change change one line in settings.py
Reload your wsgi process and you are done.