[Zope-Coders] Fw: [Zope] sessions and zope2.6.0

Chris McDonough chrism@zope.com
Tue, 22 Oct 2002 10:05:07 -0400


We're having some problems with BTrees and I'm wondering what the
best way is to isolate them.

In this bit of code:

 1        # gc the stale buckets at the "beginning" of _data
 2        # iterate over the keys in data that have no minimum value
and
 3        # a maximum value of delete_end (note: ordered set)
 4        # XXX- fixme.  range search doesn't always work (btrees
bug)
 5        for k in data.keys(None, delete_end):
 6            if k > delete_end:
 7                DEBUG and TLOG(
 8                    '_housekeep: broken range search (key %s > max
%s)'
 9                    % (k, delete_end)
10                    )
11               continue
12            bucket = data[k]
13            # delete the bucket from _data
14            del data[k]
15            DEBUG and TLOG('_housekeep: deleted data[%s]' % k)

"data" points to a IOBTree (its values are OOBTrees).  Line 5
obtains the keys from the lowest to the max key defined by
"delete_end".  There is already a bit of code in there to detect a
broken BTrees range search (lines 6-11), but this isn't really
relevant.  Line 12 attempts to get the value of one of the keys
obtained in line 5.  In some cases, it fails with a key error, which
it should never do (as all it is doing is obtaining the value of a
key which is returned from keys).

This is with Zope 2.6, and the guy who is having the problem has
reportedly recompiled Zope binaries via "python wo_pcgi".  The error
report is below, FWIW.

Ideas about how to isolate the problem are welcome...

- C

----- Original Message -----
From: "Bakhtiar A Hamid" <kedai@kedai.com.my>
To: <zope@zope.org>
Sent: Monday, October 21, 2002 9:33 PM
Subject: [Zope] sessions and zope2.6.0


hi all
i have this "key error" with sessions, that really shows itself with
zope2.6.0

previously, with 2.5.1, and 2.6.0b1, i got key error only when i
tried
iterating thru the Trancient Object (temp_folder/session_data)

now, with 2.6.0, it seems i get this error even when setting/reading
sessions.
this, however does not mean that this happens everytime.  it's a bit
unpredictable.  last time, i can still reset the Transient Object.
nowi
have to reset zope since i cannot get to the
temp_folder/session_data/manage_workspace

the relevant traceback is attached[1].  the relevant script
(python)[2]

tb[1]
Traceback (innermost last):
  Module OFS.SimpleItem, line 201, in raise_standardErrorMessage
  Module OFS.DTMLMethod, line 126, in __call__
  Module DocumentTemplate.DT_String, line 474, in __call__
  Module OFS.DTMLMethod, line 119, in __call__
  Module DocumentTemplate.DT_String, line 474, in __call__
  Module DocumentTemplate.DT_Util, line 201, in eval
   - __traceback_info__: sc_def_session_val
  Module <string>, line 2, in f
  Module Shared.DC.Scripts.Bindings, line 252, in __call__
  Module Shared.DC.Scripts.Bindings, line 283, in _bindAndExec
  Module Products.PythonScripts.PythonScript, line 315, in _exec
  Module Script (Python), line 1, in sc_def_session_val
   - <PythonScript at /kk/sc_def_session_val used for /kk/kk>
   - Line 1
  Module ZPublisher.HTTPRequest, line 1189, in __getattr__
  Module ZPublisher.HTTPRequest, line 1149, in get
  Module Products.Sessions.SessionDataManager, line 93, in
getSessionData
  Module Products.Sessions.SessionDataManager, line 180, in
_getSessionDataObject
  Module Products.Transience.Transience, line 175, in
new_or_existing
  Module Products.Transience.Transience, line 786, in get
  Module Products.Transience.Transience, line 599, in
_getCurrentBucket
  Module Products.Transience.Transience, line 688, in _housekeep
KeyError: 1035186480
------

[2]
session = context.REQUEST.SESSION
r=context.REQUEST
s_obj = session.get('username',None)

if s_obj is None:
  session.set('username',_.SecurityGetUser().getUserName())

--

http://www.kedai.com.my/             http://www.kedai.com.my/eZine
http://www.zope.org/Members/kedai    http://www.my-zope.org
If you SMELLLL...



_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )