Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Error: could not serialize access due to concurrent update

By
RockyTang
on 11/9/16, 6:50 AM 164 views

We're using odoo v9 to do our business, we developed multiple webservice interface functions based on odoo 9, which is for our mobile app to callback. Such as user login, get cart detail and place orders. And recently we have met some webservice error which is due to sql error "could not serialize access due to concurrent update" which shows in the log, the webservice functions will do some DML sql through odoo ORM, and some through raw sql such as "update table set col=..." and so on.

raw sql sample:

request.cr.execute("""   UPDATE sale_order_line SET price_unit=%s WHERE id=%s; """, (price_unit, order_line_id,))


Here comes my questions:

1> Can we eliminate the "could not serialize access due to concurrent update" error once and for all?


2> If we're not able to eliminate above error and keep using raw sql, is there a way that we can avoid it happening?


Here some log for your reference:

------------------------sample 1------------------------------

2016-10-19 11:58:45,808 107400 WARNING b2bdemo openerp.addons.app_api.models.sale_order: partner.id: 711

2016-10-19 11:58:45,808 107400 WARNING b2bdemo openerp.addons.app_api.models.sale_order: before write res partner

2016-10-19 11:58:45,817 107400 INFO b2bdemo openerp.sql_db: bad query: UPDATE "res_partner" SET "last_website_so_id"=1589,"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (711)

2016-10-19 11:58:45,818 107400 ERROR b2bdemo openerp.addons.app_api.controllers.shopcart: could not serialize access due to concurrent update

-----------------------sample 2--------------------------------

2016-11-07 08:24:02 UTC:172.16.3.55(44117):odoo@b2b:[4206]:LOG:  statement: UPDATE "bus_presence" SET "last_poll"='2016-11-07 08:24:02' WHERE id IN (42)

2016-11-07 08:24:02 UTC:172.16.3.55(44117):odoo@b2b:[4206]:ERROR:  could not serialize access due to concurrent update

2016-11-07 08:24:02 UTC:172.16.3.55(44117):odoo@b2b:[4206]:STATEMENT:  UPDATE "bus_presence" SET "last_poll"='2016-11-07 08:24:02' WHERE id IN (42)

2016-11-07 08:24:03 UTC:172.16.3.55(44117):odoo@b2b:[4206]:LOG:  statement: UPDATE "bus_presence" SET "last_poll"='2016-11-07 08:24:03' WHERE id IN (1)


0
RockyTang
On 11/10/16, 12:40 AM

anyone can help here? much appreciated.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 11/9/16, 6:50 AM
Seen: 164 times
Last updated: 11/10/16, 12:40 AM