Issue #1075 resolved

[patch] MemcachedStringEncodingError when using memcached sessions storage type

Anonymous created an issue

I set sessions storage type to memcached in production and received this error as a result: {{{ Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/CherryPy-3.2.0-py2.7.egg/cherrypy/", line 636, in respond'before_request_body') File "/usr/local/lib/python2.7/site-packages/CherryPy-3.2.0-py2.7.egg/cherrypy/", line 97, in run hook() File "/usr/local/lib/python2.7/site-packages/CherryPy-3.2.0-py2.7.egg/cherrypy/", line 57, in call return self.callback(self.kwargs) File "/usr/local/lib/python2.7/site-packages/CherryPy-3.2.0-py2.7.egg/cherrypy/lib/", line 757, in init cherrypy.serving.session = sess = storage_class(id, kwargs) File "/usr/local/lib/python2.7/site-packages/CherryPy-3.2.0-py2.7.egg/cherrypy/lib/", line 162, in init self._regenerate() File "/usr/local/lib/python2.7/site-packages/CherryPy-3.2.0-py2.7.egg/cherrypy/lib/", line 192, in _regenerate if self._exists(): File "/usr/local/lib/python2.7/site-packages/CherryPy-3.2.0-py2.7.egg/cherrypy/lib/", line 608, in _exists return bool(self.cache.get( File "build/bdist.freebsd-8.2-STABLE-i386/egg/", line 793, in get return self._get('get', key) File "build/bdist.freebsd-8.2-STABLE-i386/egg/", line 761, in _get self.check_key(key) File "build/bdist.freebsd-8.2-STABLE-i386/egg/", line 945, in check_key "Keys must be str()'s, not unicode. Convert your unicode " MemcachedStringEncodingError: Keys must be str()'s, not unicode. Convert your unicode strings using mystring.encode(charset)! }}}

OS is FreeBSD 8. Relevant packages installed:

{{{ py27-cherrypy-3.2.0 py27-memcached-1.47 python27-2.7.1_1 }}}

For now I set the storage type to ram as a workaround since I only have a single process going.

Reported by Oleg Pudeyev

Comments (3)

  1. Log in to comment