This seems to fix the problem: items = [] while sessions: k = sessions.minKey() items.append((k, sessions[k])) del sessions[k] for k, v in items: sessions[k] = v I have a trimmed down version of our DB with just the sessions in it and the necessary code to open it. If someone at Zope wants to try to debug this problem I can sent a copy. Neil