[FIX] registry: missing a threading.RLock in RegistryManager.get():
if no registry exists and several calls to RegistryManager.get() are called at the same time by several threads, several registries will be created one after the other and only the last one will be kept in cls.registries (courtesy of Guewen Baconnier (Camptocamp) Invert behaviour of commit 3685 because, at that time, the new trigger the schedule_cron_jobs method which ran another lock and called get on the registry. We had a deadlock with the cron. This is no longer the case as we don't call the same method at the end of the creation of the registry and it does not trigger a lock bzr revid: mat@openerp.com-20131114144401-k00podawlem7cjd1
This commit is contained in:
commit
7ae9e1c86d
|
@ -185,15 +185,16 @@ class RegistryManager(object):
|
||||||
@classmethod
|
@classmethod
|
||||||
def get(cls, db_name, force_demo=False, status=None, update_module=False):
|
def get(cls, db_name, force_demo=False, status=None, update_module=False):
|
||||||
""" Return a registry for a given database name."""
|
""" Return a registry for a given database name."""
|
||||||
try:
|
with cls.registries_lock:
|
||||||
return cls.registries[db_name]
|
try:
|
||||||
except KeyError:
|
return cls.registries[db_name]
|
||||||
return cls.new(db_name, force_demo, status,
|
except KeyError:
|
||||||
update_module)
|
return cls.new(db_name, force_demo, status,
|
||||||
finally:
|
update_module)
|
||||||
# set db tracker - cleaned up at the WSGI
|
finally:
|
||||||
# dispatching phase in openerp.service.wsgi_server.application
|
# set db tracker - cleaned up at the WSGI
|
||||||
threading.current_thread().dbname = db_name
|
# dispatching phase in openerp.service.wsgi_server.application
|
||||||
|
threading.current_thread().dbname = db_name
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def new(cls, db_name, force_demo=False, status=None,
|
def new(cls, db_name, force_demo=False, status=None,
|
||||||
|
|
Loading…
Reference in New Issue