Pyramid and Beaker: ValueError: insecure string pickle

463 views Asked by At

I'm having some trouble with Pyramid and Beaker (using pyramid_beaker and a memcached backend). This error started happening seemingly at random (I wasn't making any changes in the code) and it persists on requests that don't even use request.session.

I'm really not sure where to start with this, but have tried restarting memcached and using a different instance of memcached and secret. Caching was working correctly earlier. If anyone has suggestions to check I can provide more information.

Traceback (most recent call last):
  File "/var/www/web/local/lib/python2.7/site-packages/pyramid-1.3a3-py2.7.egg/pyramid/mako_templating.py", line 154, in __call__
    result = template.render_unicode(**system)
  File "/var/www/web/local/lib/python2.7/site-packages/Mako-0.5.0-py2.7.egg/mako/template.py", line 311, in render_unicode
    as_unicode=True)
  File "/var/www/web/local/lib/python2.7/site-packages/Mako-0.5.0-py2.7.egg/mako/runtime.py", line 660, in _render
    **_kwargs_for_callable(callable_, data))
  File "/var/www/web/local/lib/python2.7/site-packages/Mako-0.5.0-py2.7.egg/mako/runtime.py", line 692, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/var/www/web/local/lib/python2.7/site-packages/Mako-0.5.0-py2.7.egg/mako/runtime.py", line 718, in _exec_template
    callable_(context, *args, **kwargs)
  File "/var/www/web/local/lib/python2.7/site-packages/pyramid_debugtoolbar-0.9.7-py2.7.egg/pyramid_debugtoolbar/templates/toolbar.mako", line 61, in render_body
    ${panel.content()|n}
  File "/var/www/web/local/lib/python2.7/site-packages/pyramid_debugtoolbar-0.9.7-py2.7.egg/pyramid_debugtoolbar/panels/request_vars.py", line 44, in content
    'session': dictrepr(self.request.session),
  File "/var/www/web/local/lib/python2.7/site-packages/pyramid_debugtoolbar-0.9.7-py2.7.egg/pyramid_debugtoolbar/utils.py", line 145, in dictrepr
    for val in d:
  File "/var/www/web/local/lib/python2.7/site-packages/Beaker-1.6.2-py2.7.egg/beaker/session.py", line 672, in __iter__
    return iter(self._session().keys())
  File "/var/www/web/local/lib/python2.7/site-packages/Beaker-1.6.2-py2.7.egg/beaker/session.py", line 646, in _session
    **params)
  File "/var/www/web/local/lib/python2.7/site-packages/Beaker-1.6.2-py2.7.egg/beaker/session.py", line 160, in __init__
    self.load()
  File "/var/www/web/local/lib/python2.7/site-packages/Beaker-1.6.2-py2.7.egg/beaker/session.py", line 324, in load
    self.namespace.acquire_read_lock()
  File "/var/www/web/local/lib/python2.7/site-packages/Beaker-1.6.2-py2.7.egg/beaker/container.py", line 211, in acquire_read_lock
    self.open('r', checkcount = True)
  File "/var/www/web/local/lib/python2.7/site-packages/Beaker-1.6.2-py2.7.egg/beaker/container.py", line 243, in open
    self.do_open(flags, replace)
  File "/var/www/web/local/lib/python2.7/site-packages/Beaker-1.6.2-py2.7.egg/beaker/container.py", line 659, in do_open
    self.hash = cPickle.load(fh)
ValueError: insecure string pickle
1

There are 1 answers

0
Ross On

I haven't found a root cause, but after two hours it appears to be working again - as far as I can guess a cache invalidated or something timed out.