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"
Stephan Richter wrote at 2008-1-30 08:45 -0500:
... 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.
This is normal for persistent objects. When a persistent object is in Ghost state, its "__dict__" appears to be empty (it is empty). When you access a non special attribute, the object is unghosted and then "__dict__" is filled in.
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.
What is "session package data"? -- Dieter
On Wednesday 30 January 2008, Dieter Maurer wrote:
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.
What is "session package data"?
A very simple object: class SessionPkgData(persistent.Persistent, IterableUserDict): """See zope.session.interfaces.ISessionData >>> session = SessionPkgData() >>> ISessionPkgData.providedBy(session) True """ zope.interface.implements(ISessionPkgData) def __init__(self): self.data = OOBTree() (zope.session.session, line 517) Regards, Stephan -- Stephan Richter Web Software Design, Development and Training Google me. "Zope Stephan Richter"
Hi, It's been a long day and I am way out of my league on this issue, so I will just go in off-topic mode and share a bash trick. Stephan Richter, on 2008-01-30:
cd sessionIssue2 for number in 1 2 3 4 5 6 7 8 ;do sh sessionTest.sh;done
You can also do: for number in $(seq 8); do sh sessionTest.sh;done Thank you and good night. :) -- Maurits van Rees | http://maurits.vanrees.org/ Work | http://zestsoftware.nl/ "This is your day, don't let them take it away." [Barlow Girl]
participants (3)
-
Dieter Maurer -
Maurits van Rees -
Stephan Richter