[Zope] Threads, ZODB, deactivate, setstate, etc...

Peter Bengtsson mail@peterbe.com
Thu, 9 Aug 2001 11:56:17 +0200


Honestly, I didn't read your whole mail but I saw some error messages there
that I recognized.
Those error messages means that there is an object/transaction that is
half-complete somewhere.
The internals of that is probably some misstake by yourself.

I've solved it ones by just restarting Zope, and another time we had to cut
the database at the end to get rid of the situation.
So, my advice is that you use the error message and search the archives
because your soltution might have litte to do with your product.

Peter
----- Original Message -----
From: "Olivier Deckmyn" <odeckmyn.list@teaser.fr>
To: "'Zope@Zope. Org'" <zope@zope.org>
Sent: Thursday, August 09, 2001 9:38 AM
Subject: [Zope] Threads, ZODB, deactivate, setstate, etc...


> Hi there !
>
> I am working on my product ZExternalNews
> (http://www.zope.org/Members/odeckmyn/ZExternalNews).
> I have a problem that I did not have anticipated !
>
> My product is made of 3 classes:
>
> 1/ ZExternalNewsManager (usually one per site), folderish that contains
> several ZExternalNewsChannel
> 2/ ZExternalNewsChannel (several per Manager), itemish. Contains 2
> persistent properties (title and url) and a _v_items, a list of
> ZExternalNewsItem
> 3/ ZExternalNewsItem a very simple Python class (no inheritance from zope
> nor ZODB). It handles an atomic news item (like a single news item in
> slashdot for example).
>
> When ZExternalNewsManager starts, I also "fork" a thread that (simplified)
> does :
>
> while 1:
>     MyManager.Refresh()
>     sleep(MyManager.delay)
>
> Where MyManager.Refresh is a loop that calls refresh on every channel.
>
> This would work in a wonderful land...but not in real life. I've been
> searching for hours now...
> My problem is :
>
>
> It works for some time (sometime 10sec, sometimes 2 hours, sometime 10
> min...), and then, I got a lot of :
>
>
> 2001-08-07T17:36:04 ERROR(200) ZODB Couldn't load state for
> '\000\000\000\000\000\000WG'
> Traceback (innermost last):
>   File /isp/zope/newfun/lib/python/ZODB/Connection.py, line 508, in
setstate
> AttributeError: 'None' object has no attribute 'load'
>
> (a lot of = one per ZExternalChannel instance)
>
> and a last :
>
> Exception in thread Thread-4:
> Traceback (innermost last):
>   File "/usr/local/lib/python1.5/threading.py", line 376, in __bootstrap
>     self.run()
>   File
> "/isp/zope/newfun/lib/python/Products/ZExternalNews/ZExternalNews.py",
line
> 454, in run
>     self._manager.Refresh()
>   File "/isp/zope/newfun/lib/python/ZODB/Connection.py", line 508, in
> setstate
>     p, serial = self._storage.load(oid, self._version)
> AttributeError: 'None' object has no attribute 'load'
>
> After hours of thinking, I think this is because ZODB ask my objects to go
> to sleep (is this DEACTIVATING ?).
>
> The last modification I made was to implement __setstate__ so that _v_*
> attributes are declared there : I thought it would be ok after that. It is
> not :(
>
>
> Please help me ! It is quite a frustrating experience ! Do not hesitate to
> Is there a document I should read before understanding ? I think I've read
> quite a lot of things until now ! ;)
>
> Attached is the latest version of the .py. Other part of the product is
> downloadable here : http://www.zope.org/Members/odeckmyn/ZExternalNews
>
> Thanx for your support.
>
> Olivier.
>
> (this question was posted 2 days ago on zope-dev, without answer, so I try
> here ;-D )
>