Since it's first implementation at [1], a new cursor is created to then build a new environment after the website's `authenticate` overide with the new `uid` of the logged in user. Since the new visitor SQL upsert refactoring done at [2], it seems to be introducing a SQL deadlock sometimes. It has been detected on odoo.com while monitoring the logs. Despite being quite rare, it still happens too often due to our heavy trafic. Step to reproduce (among others): - Install website_livechat - Login as admin on 127.0.0.1 - On 127.0.0.2, load the website - Open the livechat - Type something in the discussion - Directly try to login as admin - It will load for a certain time then crash on a 502 timeout due to the SQL deadlock - You may need to repeat the process to actually face the bug [1]: https://github.com/odoo/odoo/commit/6bec0e4d29e6b33b74962b2893a7a405667ef58c [2]: https://github.com/odoo/odoo/commit/d348bed1ad9d3d16b295f013f015706be6c07820 closes odoo/odoo#109830 X-original-commit: b241cf7de9329af1410b9dd45b161aa41926effb Signed-off-by: Olivier Dony (odo) <odo@odoo.com> Signed-off-by: Romain Derie (rde) <rde@odoo.com>