itpp-labs / pos-addons

Odoo POS Addons
https://itpp.dev
MIT License
365 stars 581 forks source link

Could not serialize, due to concurrent update. Missing orders #917

Closed farazbdm closed 5 years ago

farazbdm commented 5 years ago

Issue faced with pos multi sync in restaurant mode.

Some specific tables become randomly empty and the orders placed on them disappear, after being on hold for a while.

These orders are printed in the Kitchen, but almost by the time the customer has dined and appears to pay for the food at the cashier, We find that the order vanished from the table.

It happens random, on random table.

We have 1 main cashier and 2 waiter tabs configured, with across multi sync features.

Issue still existed for random order.

Luckily, I have been able to replicate the issue now. 1- open 2 user separate 2 sessions with multi session configured.

2- let user1 device go offline, let it take order. Order uid assigned would be for e.g. 177 bcoz when it when offline the previous order registered and synced uid was 176.

3- while user1 went offline, take order # 177 from user2 session on device which is online. assure both orders have orderlines pushed to KitchenOrder, empty order retakes the uid upon syncing, but filled order doesn’t.

4- now let user1 device come online and let it try to sync order uid#177 to multi-session.

5-at this time because there are 2 order uid #177 trying to sync to server, as 2 update messages received for multi_session_sync_order.

6-Postgre register’s error bad query “Could not serialize access due to concurrent update.”

7-As a result order uid # 177 disappear from POS.

gustavovalverde commented 5 years ago

I also went through this @farazda1. It was because of pgbouncer; are you using something similar there?

yelizariev commented 5 years ago

I added a not about PgBouncdr https://github.com/it-projects-llc/pos-addons/commit/81958784c6f050659b95e3ad92d0f3b35b7caf9c

gustavovalverde commented 5 years ago

Based on https://github.com/it-projects-llc/pos-addons/commit/81958784c6f050659b95e3ad92d0f3b35b7caf9c and https://github.com/it-projects-llc/pos-addons/commit/1bf7a1023f1d63bb8ae6d9dc21089f4f9507a064 this can be closed @yelizariev

yelizariev commented 5 years ago

Another update might be related: https://github.com/it-projects-llc/pos-addons/commit/2a7327562a7456eabad7897ae271700faa77f152

@farazda1 do you mean UID or sequence_number? UIDs must be unique if you use different POSes. Feel free to reopen the issue if you have same problem in latest version