[Zope-dev] Session concurrency problem

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Jan 30 08:45:06 EST 2008


Hi everyone,

I have come across a situation, where temporarily the session data for a user 
is not available.

Scenario: User 1 creates some session data. While a user 2 creates also some 
session data, user 1's data is not accessible.

The problem plays out in two ways:

1. The data's __dict__ returns an empty dictionary. When you access an 
attribute directly, though, the data can be seen. This symptom can be 
reliably reproduced.

2. Sometimes, the session package data does not have the data in it and fails 
with a key error. This happens maybe 1 in 50 times and I have not reliably 
reproduced this problem.

There are no conflict errors. And when I store the data to the root folder 
using the client id, I never see any of the two problems.

This makes me believe that the issue is contained to the session code. The 
only two things that seem specific to the session code is the sweeping 
algorithm. The comment in zope.session.session, line 192 discusses some 
issues of sweep, but I am not sure it is relevant.

I have attached a package that demonstrates the issue. (This is one of the 
major benefits of having buildout and eggs!) Here is how you get the problem 
reproduced:

tar xvzf sessionIssue2.tgz
cd sessionIssue2
python2.4 bootstrap.py
./bin/buildout -N
./bin/demo fg

In a separate shell:

cd sessionIssue2
for number in 1 2 3 4 5 6 7 8 ;do sh sessionTest.sh;done

The before and after result should always be the same. You can change the demo 
code to not use sessions and see that it works. You can also see the 
differences between accessing __dict__ and an attribute directly.

So, does anyone have an idea of what is happening here? Any hints are greatly 
appreciated!

Regards,
Stephan
-- 
Stephan Richter
Web Software Design, Development and Training
Google me. "Zope Stephan Richter"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sessionIssue2.tgz
Type: application/x-tgz
Size: 4129 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20080130/4e840f5b/sessionIssue2.bin


More information about the Zope-Dev mailing list