On 11/03/2004, at 1:07 PM, Chris McDonough wrote:
On Wed, 2004-03-10 at 18:30, michael wrote:
On closer inspection I have another small detail - I'm only seeing these KeyError's for sessions that have had a chance to expire and when trying to access the session from standard_error_message.
Can you provide a complete traceback for the error message? I'm guessing that it happens during session garbage collection but I can't be sure without the traceback.
hmmm... continuing to refine what I think I'm seeing :-O I don't get a KeyError thrown until *after* at least one rendering of standard_error_message that includes an access to a session variable. And I'm only getting KeyError's for sessions that have had a chance to expire. And that KeyError will be thrown whenever any access is made for the session. (Previously I thought I was *only* seeing KeyError's being thrown from standard_error_message.) I can't yet say from what I'm seeing if the session accessed in standard_error_message which somehow corrupts the consistency of transience is the same session for which the KeyError is thrown further down the track. Here is an example traceback when the KeyError is thrown from a Script (Python) that reads the session variable. Followed by a similar traceback thrown when Zope tries to read that same sesssion variable in my standard_error_message: 2004-03-11T16:13:03 ERROR(200) SiteError http://localhost:8080/test/read Traceback (most recent call last): File "/Users/michael/Desktop/Zope-2.7.0/lib/python/ZPublisher/Publish.py", line 101, in publish request, bind=1) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/ZPublisher/mapply.py", line 88, in mapply if debug is not None: return debug(object,args,context) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/ZPublisher/Publish.py", line 41, in call_object result=apply(object,args) # Type s<cr> to step into published object. File "/Users/michael/Desktop/Zope-2.7.0/lib/python/Shared/DC/Scripts/ Bindings.py", line 306, in __call__ return self._bindAndExec(args, kw, None) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/Shared/DC/Scripts/ Bindings.py", line 343, in _bindAndExec return self._exec(bound_data, args, kw) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/Products/PythonScripts/ PythonScript.py", line 318, in _exec result = f(*args, **kw) File "Script (Python)", line 2, in read File "/Users/michael/Desktop/Zope-2.7.0/lib/python/ZPublisher/ HTTPRequest.py", line 1218, in __getattr__ v = self.get(key, default, returnTaints=returnTaints) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/ZPublisher/ HTTPRequest.py", line 1178, in get if callable(v): v = v() File "/Users/michael/Desktop/Zope-2.7.0/lib/python/Products/Sessions/ SessionDataManager.py", line 93, in getSessionData return self._getSessionDataObject(key) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/Products/Sessions/ SessionDataManager.py", line 180, in _getSessionDataObject ob = container.new_or_existing(key) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/Products/Transience/ Transience.py", line 176, in new_or_existing item = self.get(key, notfound) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/Products/Transience/ Transience.py", line 809, in get v = self._data[b].get(k, notfound) KeyError: 1078974700 ------ 2004-03-11T16:13:04 BLATHER(-100) OFS Exception while rendering an error message Traceback (most recent call last): File "/Users/michael/Desktop/Zope-2.7.0/lib/python/OFS/SimpleItem.py", line 204, in raise_standardErrorMessage v = s(**kwargs) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/Shared/DC/Scripts/ Bindings.py", line 306, in __call__ return self._bindAndExec(args, kw, None) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/Shared/DC/Scripts/ Bindings.py", line 343, in _bindAndExec return self._exec(bound_data, args, kw) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/Products/PythonScripts/ PythonScript.py", line 318, in _exec result = f(*args, **kw) File "Script (Python)", line 12, in standard_error_message File "/Users/michael/Desktop/Zope-2.7.0/lib/python/ZPublisher/ HTTPRequest.py", line 1218, in __getattr__ v = self.get(key, default, returnTaints=returnTaints) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/ZPublisher/ HTTPRequest.py", line 1178, in get if callable(v): v = v() File "/Users/michael/Desktop/Zope-2.7.0/lib/python/Products/Sessions/ SessionDataManager.py", line 93, in getSessionData return self._getSessionDataObject(key) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/Products/Sessions/ SessionDataManager.py", line 180, in _getSessionDataObject ob = container.new_or_existing(key) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/Products/Transience/ Transience.py", line 176, in new_or_existing item = self.get(key, notfound) File "/Users/michael/Desktop/Zope-2.7.0/lib/python/Products/Transience/ Transience.py", line 809, in get v = self._data[b].get(k, notfound) KeyError: 1078974700 And the Python (Script) 'read' looks like: request = container.REQUEST session = request.SESSION count = session.get('count',0) return str(count) Michael