Bugs item #3525829, was opened at 2012-05-11 06:34
Message generated for change (Comment added) made by phd
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3525829&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: General
Group: SQLObject from repository
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: LJSilver (ljsilver)
>Assigned to: Oleg Broytman (phd)
Summary: KeyError in multiprocessing environment
Initial Comment:
When disabling the cache, SQLObject works quiet well in a multiprocessing environment.
Sometimes SQLObject throws KeyError from the sqlobject.cache.CacheSet.put method in the following line:
self.caches[cls.__name__].put(id, obj)
This seems to be because of a mapped object is put back to the DB without getting it from the DB in the same process.
----------------------------------------------------------------------
>Comment By: Oleg Broytman (phd)
Date: 2012-05-11 06:53
Message:
What have you done to have the row without getting it first?! Did you get
the row from DB in one process and passed it to the other process? How do
you pass objects between processes?
----------------------------------------------------------------------
Comment By: LJSilver (ljsilver)
Date: 2012-05-11 06:35
Message:
I've managed to fix it using the following monkey patch:
def sqlobject_cache_put_monkey(self, id, cls, obj):
try:
self.caches[cls.__name__].put(id, obj)
except KeyError:
self.caches[cls.__name__] =
sqlobject.cache.CacheFactory(*self.args, **self.kw)
self.caches[cls.__name__].put(id, obj)
sqlobject.cache.CacheSet.put = sqlobject_cache_put_monkey
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3525829&group_id=74338
|