dataflake.org

Home Documentation Software Old Stuff

Display of chached users inkonsistent (Resolved)

Request LDAP User Folder -- question -- by Stefan Loidl
Posted on Jun 26, 2008 4:51 am
Subscribe

Enter your email address to receive mail on every change to this issue.

Entries (Latest first)


  Comment by Stefan Loidl on Jul 23, 2008 3:36 am
  Works for me in test and production.

Thanks!

And I will add another issue concerning 'Last Access Time'.
 

  Resolve by Jens Vagelpohl on Jul 21, 2008 4:33 pm
  I have chosen a different way: Since it's not really necessary to recreate the hash key on every object load I simply removed the regeneration from __setstate__:

http://svn.dataflake.org/viewvc?view=rev&revision=1579

If you find any further issues please let me know.
 

  Comment by Jens Vagelpohl on Jul 21, 2008 10:00 am
  Ah, that's an excellent observation and it may explain the issue. I'll
try to think of a better solution for the hash/unique marker generation.


 

  Comment by Stefan Loidl on Jul 21, 2008 9:48 am
  I can reproduce the behaviour in a test environment with only one LDAP user login in.

I have set the timeout of the authenticated cache to 86400 (one day). If I log in with the user, I can see him in the 'Caches' tab.

If I then start a Zope request which takes some time (e.g. a long running database query) I can't see the user in the 'Caches' tab. After the other request has completed the user is displayed again.

I did also take a look at the source code of LDAPUserFolder.py and it seems to me that the source of the problem is in the __setstate__ funtion in line 136:

self._hash = '%s%s' % (self.meta_type, str(random.random()))

I assume that the hash in the object is set only per thread
(but my Zope / python programming experience is quite limited).

If I replace the above line with (which I think is ok for my enviroment, because I only have got one LDAPUserFolder instance):

self._hash = '%s%s' % (self.meta_type, '123456')

the problem does not appear any more.

I switched several times between the two lines in the source
code and the result has always been the same. The problem only occurs with the original version.

Of course the above line is no general solution, as it would lead to problems in installations with more than one LDAPUserFolder instance. But currently I don't know a solution which would guarantee that the hash is the same in each thread, but different for another LDAPUserFolder instance.
 

  Comment by Jens Vagelpohl on Jul 19, 2008 6:30 am
  The cache is supposed to be thread-independent. If you can come up with a reproducible test case showing the problem, like a unit test or similar, I'll be happy to look at it.
 

  Initial Request by Stefan Loidl on Jun 26, 2008 4:51 am
  The display of cached users sometimes switches in my installation between two almost completely different sets. E.g first users A, B, C and D are displayed, and then the users B, E, F and G.

It seems to me that this depends on the python process/thread(?) which serves the request(s).

Is this the intended behaviour or is this a bug?

My environement:
Python 2.4.5
Zope 2.10.6
LDAPUserFolder 2.9
SLES 9

Thanks.