Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FIX] p3: race condition when *reloading* an existing db
When re-launching Odoo on an existing database in Python 3.6[0] it's possible that the scheduler will preempt the main thread mid-module-import and run the cron thread which causes registry (and module) initialisation with only a subset of the Python files loaded and thus e.g. tries loading auth_crypt with a registry in which none of res has been loaded makes for interesting situations. Delay spawning the cron thread until *after* the registry preload at least, though I don't think that actually entirely fixes the issue. [0] and probably in any Python >= 3.3, I'm guessing it's related to the per-module import locks which replaced the old global lock: https://docs.python.org/3.3/whatsnew/3.3.html#a-finer-grained-import-lock though since ir.cron has little reason to import anything it could also just be Python 3 scheduler changes which allow/cause a context-switch during imports while the Python 2 scheduler would not allow that. IDK.
- Loading branch information