summaryrefslogtreecommitdiff
path: root/odoo/service
diff options
context:
space:
mode:
authorNans Lefebvre <len@odoo.com>2019-09-18 13:14:34 +0000
committerfw-bot <otis@odoo.com>2019-09-19 15:44:59 +0000
commit151666b79d1fab2666b5078bc6b81a7fba12c53a (patch)
treeae3b1e60e199f88278388889c867e5bbeb177c65 /odoo/service
parentf00d6aaeafdc7206338e24b04b298705fd9d08dc (diff)
[FIX] service: clear environments between transaction retries
Initial bug report, full of red herrings: receive two support requests by email while on Odoo.sh, the first creates a ticket, while the second replies to the server with the error: 550 Requested action not taken: mailbox unavailable When a request is done, the service check function tries each request multiple times when getting Operational errors. When two email are received within a 'short' amount of time (e.g .1 second) the two requests are initiated with a new cursor. When both mails generate the creation of a new record of the same model, the second cursor is going to fail because of an: ERROR: could not serialize access due to concurrent update However, the record we used in the computations needed in the creation of the second record have been added to the environment. When that second creation is retried, it will operate on the same records, and find them in the todo, with the environment that was obtained for the first trial. Since the cursor is closed, this crashes. To explain the bug report, Odoo.sh transfers the mail through an xmlrpc to process the mail. Because of this crash, the server interprets the lack of well-formed response by a generic 'mailbox unavailable'. opw 2060476 closes odoo/odoo#37165 X-original-commit: 845eecdfa7b27d84862e94f4b63d40a851e0c410 Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
Diffstat (limited to 'odoo/service')
-rw-r--r--odoo/service/model.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/odoo/service/model.py b/odoo/service/model.py
index ca997d0f730..e5002f5e350 100644
--- a/odoo/service/model.py
+++ b/odoo/service/model.py
@@ -161,6 +161,7 @@ def check(f):
return wrapper
def execute_cr(cr, uid, obj, method, *args, **kw):
+ odoo.api.Environment.reset() # clean cache etc if we retry the same transaction
recs = odoo.api.Environment(cr, uid, {}).get(obj)
if recs is None:
raise UserError(_("Object %s doesn't exist") % obj)