Activity log for bug #1238560

Date Who What changed Old value New value Message
2013-10-11 09:21:56 Guewen Baconnier @ Camptocamp bug added bug
2013-10-11 09:28:26 Launchpad Janitor branch linked lp:~camptocamp/openobject-server/7.0-registrymanager-rlock-1238560-gbr
2013-10-11 10:42:37 Launchpad Janitor branch linked lp:~camptocamp/openobject-server/trunk-registrymanager-rlock-1238560-gbr
2013-10-11 10:51:38 Guewen Baconnier @ Camptocamp description Hi, I just get caught by this bug, which is very hard to reproduce. It happens only when: - you have a thread which starts when a module is loaded - the thread calls openerp.pooler.get_pool() - OpenERP is started from an external script, like "behave" or with "oe" when running the python tests (does not seems to happen when started from openerp-server) It gives errors as this example: File ".../server/openerp/service/web_services.py", line 433, in dispatch return fn(*params) File ".../server/openerp/service/web_services.py", line 438, in exp_login res = security.login(db, login, password) File ".../server/openerp/service/security.py", line 31, in login return user_obj.login(db, login, password) AttributeError: 'NoneType' object has no attribute 'login' Cause: RegistryManager.get() on: http://bazaar.launchpad.net/~openerp/openobject-server/7.0/view/5096/openerp/modules/registry.py#L185 It must be protected by cls.registries_lock because it may return the registry from cls.registries or create a new one. What happens when there is no registry and 2 threads calls RegistryManager.get() at the same time: - they both have a KeyError - they both execute RegistryManager.new(). This one is protected by the RLock but that's already too late - the first threads create a new Registry. RegistryManager.get() returns this Registry - then the second thread create a new Registry and replace the first one in cls.registries. RegistryManager.get() returns this Registry If RegistryManager.get() have been surrounded by a RLock, the second thread would just have waited and would not have created a new Registry. The branch is coming. Hi, I just get caught by this bug, which is very hard to reproduce. It happens only when:  - you have more than 1 thread which starts when a module is loaded  - a child thread calls openerp.pooler.get_pool()  - OpenERP is started from an external script, like "behave" or "oe" when running the python tests (does not seems to happen when started from openerp-server) It gives errors as this example:   File ".../server/openerp/service/web_services.py", line 433, in dispatch     return fn(*params)   File ".../server/openerp/service/web_services.py", line 438, in exp_login     res = security.login(db, login, password)   File ".../server/openerp/service/security.py", line 31, in login     return user_obj.login(db, login, password) AttributeError: 'NoneType' object has no attribute 'login' Cause: RegistryManager.get() on: http://bazaar.launchpad.net/~openerp/openobject-server/7.0/view/5096/openerp/modules/registry.py#L185 It must be protected by cls.registries_lock because it may return the registry from cls.registries or create a new one. What happens when there is no registry and 2 threads calls RegistryManager.get() at the same time:  1. they both have a KeyError  2. they both execute RegistryManager.new(). This one is protected by the RLock but that's already too late  3. the first thread create a new Registry. RegistryManager.get() returns this Registry  4. then the second thread create a new Registry and replace the first one in cls.registries. RegistryManager.get() returns this Registry 5. One of the registry (could not see which) has no models => self.pool.get() always returns None If RegistryManager.get() had been surrounded by a RLock, the second thread would just have waited and would not have created a new Registry. The branch is coming.
2013-10-14 08:38:34 Vinay Rana (OpenERP) openobject-server: assignee OpenERP Publisher's Warranty Team (openerp-opw)
2013-10-14 08:38:52 Vinay Rana (OpenERP) tags maintenance
2013-11-04 10:47:27 Guewen Baconnier @ Camptocamp bug task added ocb-server
2013-11-04 10:53:29 Launchpad Janitor branch linked lp:~camptocamp/ocb-server/7.0-registrymanager-rlock-1238560-gbr
2013-11-14 14:44:35 Martin Trigaux (OpenERP) openobject-server: status New Confirmed
2013-11-14 14:44:40 Martin Trigaux (OpenERP) openobject-server: importance Undecided Low
2013-11-14 14:58:27 Martin Trigaux (OpenERP) openobject-server: status Confirmed Fix Released
2013-11-14 15:51:30 Stefan Rijnhart (Opener) bug task deleted ocb-server