This question has been flagged
3 Replies
20549 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)


Avatar
Discard
Best Answer

Hi

I think there are quite a few similar issues on the forum. the following one might be helpful to your situation.

\https://www.odoo.com/forum/help-1/question/transactionrollbackerror-a-possible-solution-69070

However, I think the module (ref: https://bitbucket.org/xcg/base_res_users_streamline/overview ) is not design for v9, you might need to port the module by yourself.

Regards,

Tim

Avatar
Discard
Best Answer

Did you find a solution for this issue ?

Avatar
Discard
Author Best Answer

anyone can help here? much appreciated.

Avatar
Discard