[ZODB-Dev] ZODB+threading issue (need your help)

Anton Zubenko zubenko@softhome.net
Thu, 21 Nov 2002 16:51:00 +0200


hello all

Roughly my problem looks as follows:

i need to fork threads, fetching pop3 messages for several accounts 
within my zope external method. The fetched data should to be converted 
into ZODB objects and stored within my zope Data.fs afterwards
Without threads my code works as expected.
If i call the main function within a new thread (using threading.py), 
ZODB part of my code produces totally bogus results. From time to time 
it ends up with an error

   ***Shouldn't load state for .... when connection is closed

at different lines of the code, which implement my attempts to get an 
object using either getattr or restrictedTraverse (both functions fail 
at this point) or simply trying to get/change object's property.
Even if the object is traversed without problems, incrementing it's 
integer property returns really incremented value,
but within ZMI i see no changes. Next time when external methos is 
called, this incremented value still grows, but still no result is seen 
in ZMI.
This is just an example - changing anything within ZODB works only until 
i'm running my thread, but i see no actual changes  afterwards. The most 
weird fact is that next time external method is called it sees ZODB as 
if it has been changed, however ZMI refuses to admit this.

Dropping threads off fixes the problem.
Where should i go to get a workaround?

Any ideas are highly appreciated,
thanks in advance!


Anton Zubenko,
Axystem