POSKeyError when getting Zope SESSION
Maurits van Rees <[email protected]> Tue, 6 Mar 2018 18:36:34 +0100
| Newsgroups | gmane.comp.web.zope.zodb |
|---|---|
| Organization | Zest Software |
| Message-ID | <[email protected]> |
Hi,
Full details are at:
https://community.plone.org/t/sessions-and-poskeyerrors/5939
Summary:
- Using Python 2.7.14, ZODB 5.3.0, Zope2 2.13.26, tempstorage 4.0.1,
BTrees 4.4.1, Plone 5.1.
- Zope stores sessions in temporary storage, based on a session in in a
cookie.
- My authentication plugin gets the session and may set some values in it.
- Problem: getting the session sometimes gives a POSKeyError.
- This is for a new site that is in development, so I only tested it
locally on my Mac. One Zope instance, no ZEO setup.
Sample traceback:
2018-03-02T16:07:51 ERROR client.myplugin KeyError getting SESSION for
request http://127.0.0.1:8080/Plone/++resource++protect.js
Traceback (most recent call last):
File ".../myplugin/plugins.py", line 31, in get_session
return request.SESSION
File
"/Users/maurits/shared-eggs/cp27m/Zope2-2.13.26-py2.7.egg/ZPublisher/HTTPRequest.py",
line 1380, in __getattr__
v = self.get(key, default, returnTaints=returnTaints)
File
"/Users/maurits/shared-eggs/cp27m/Zope2-2.13.26-py2.7.egg/ZPublisher/HTTPRequest.py",
line 1337, in get
v = v()
File
"/Users/maurits/shared-eggs/cp27m/Zope2-2.13.26-py2.7.egg/Products/Sessions/SessionDataManager.py",
line 101, in getSessionData
return self._getSessionDataObject(key)
File
"/Users/maurits/shared-eggs/cp27m/Zope2-2.13.26-py2.7.egg/Products/Sessions/SessionDataManager.py",
line 188, in _getSessionDataObject
ob = container.new_or_existing(key)
File
"/Users/maurits/shared-eggs/cp27m/Zope2-2.13.26-py2.7.egg/Products/Transience/Transience.py",
line 839, in new_or_existing
item = self.get(key, _marker)
File
"/Users/maurits/shared-eggs/cp27m/Zope2-2.13.26-py2.7.egg/Products/Transience/Transience.py",
line 495, in get
item = self._move_item(k, current_ts, default)
File
"/Users/maurits/shared-eggs/cp27m/Zope2-2.13.26-py2.7.egg/Products/Transience/Transience.py",
line 314, in _move_item
if abucket.get(k, None) is not None:
File
"/Users/maurits/shared-eggs/cp27m/ZODB-5.3.0-py2.7.egg/ZODB/Connection.py",
line 796, in setstate
p, serial = self._storage.load(oid)
File
"/Users/maurits/shared-eggs/cp27m/ZODB-5.3.0-py2.7.egg/ZODB/mvccadapter.py",
line 143, in load
r = self._storage.loadBefore(oid, self._start)
File
"/Users/maurits/shared-eggs/cp27m/tempstorage-4.0.1-py2.7.egg/tempstorage/TemporaryStorage.py",
line 187, in loadBefore
raise POSException.POSKeyError(oid)
POSKeyError: 0x13
This error then keeps happening (at least for the user with this
session) until I restart the Zope instance.
I tried creating a simple script to reproduce it, but I failed.
Today I did not see the error at all.
I enabled a debugging environment variable Z_TOC_DEBUG from
Products.Transience, but since the error did not happen since then, I
have no debug data from it...
Maybe it only fails when a BTree in the session needs to be reshuffled
or something.
My current plan is to avoid using a session for this, and instead store
what I need in a cookie. That should also avoid possible problems in a
setup with multiple zeoclients.
But does anyone have an idea what is going on here and how to avoid this?
Again, full details are at:
https://community.plone.org/t/sessions-and-poskeyerrors/5939
Thanks,
--
Maurits van Rees: http://maurits.vanrees.org/
Zest Software: http://zestsoftware.nl
--
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.