Openbravo Issue Tracking System - Retail Modules
View Issue Details
0027162Retail ModulesWeb POSpublic2014-07-23 09:582014-08-01 16:45
marvintm 
marvintm 
normalcriticalhave not tried
closedfixed 
5
 
 
Orekaria
No
0027162: Due to wrong uuid generation, it could happen that tickets are lost
The Web POS uses the following mechanism to generate and synchronize data (such as tickets):

- A unique identifier (UUID) is generated for every document created in the client side.
- When the document is complete, it is sent to the backend with this identifier included.
- The backend verifies that a document with this id doesn't exist. If it exists, it considers the document as a duplicate.
- If it doesn't, it saves the document.
- When the backend replies to the client side that the synchronization went well, then the client side removes the document from its internal database.

This system is designed to avoid the problem of duplicated documents, by identifying each one with a unique id. This problem might happen if the client loses connection after sending a document. As it has lost connection, it cannot receive the response from the backend, and therefore it cannot be sure that it was saved correctly, so in this case it sends it again. However, as it has a unique id, the backend will find it and therefore will not duplicate it.

The issue here is that in some cases, it has been detected that the function which generates unique ids in the client side can in fact generate the same id more than once, due to how it is constructed.

This can cause that tickets are lost, due to being incorrectly identified as duplicated.
There are no clear steps to reproduce. This has been reproduced in a real customer however.
The get_uuid function needs to be rebuilt so that it works correctly.
No tags attached.
related to feature request 0026977RR14Q4 closed marvintm Retail Stabilization: Failure Proof Ticket Saving, save to websql before printing 
Issue History
2014-07-23 09:58marvintmNew Issue
2014-07-23 09:58marvintmAssigned To => marvintm
2014-07-23 09:58marvintmTriggers an Emergency Pack => No
2014-07-23 10:57mtaalIssue Monitored: mtaal
2014-07-23 11:08adrianromeroRelationship addedrelated to 0026977
2014-07-24 12:40hgbotCheckin
2014-07-24 12:40hgbotNote Added: 0068860
2014-07-24 12:40hgbotStatusnew => resolved
2014-07-24 12:40hgbotResolutionopen => fixed
2014-07-24 12:40hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/f440ab4b2250d1e90a2bdad3976b38953aaf4567 [^]
2014-07-24 12:41hgbotCheckin
2014-07-24 12:41hgbotNote Added: 0068861
2014-07-24 12:41hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/f440ab4b2250d1e90a2bdad3976b38953aaf4567 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/cd5c9600321bf250f4061acce65747536deec358 [^]
2014-07-24 12:48hgbotCheckin
2014-07-24 12:48hgbotNote Added: 0068862
2014-07-24 13:55OrekariaReview Assigned To => Orekaria
2014-07-24 13:55OrekariaNote Added: 0068867
2014-07-24 13:55OrekariaStatusresolved => closed
2014-07-24 17:25OrekariaNote Added: 0068872
2014-08-01 16:45hgbotCheckin
2014-08-01 16:45hgbotNote Added: 0069036

Notes
(0068860)
hgbot   
2014-07-24 12:40   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: f440ab4b2250d1e90a2bdad3976b38953aaf4567
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Thu Jul 24 12:39:21 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/f440ab4b2250d1e90a2bdad3976b38953aaf4567 [^]

Fixed issue 27162. Two changes have been made:
- A new uuid generation method has been included. This new method will work much better, and should not produce duplicated ids.
- An additional check has been added, in case the id of the new ticket corresponds to the id of an existing ticket. In this case, the document numbers will be compared to verify that the tickets are indeed the same, and otherwise, the new ticket will be saved as an error instead of being discarded.

---
M src/org/openbravo/mobile/core/process/DataSynchronizationProcess.java
M web/org.openbravo.mobile.core/source/data/ob-dal.js
---
(0068861)
hgbot   
2014-07-24 12:41   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: cd5c9600321bf250f4061acce65747536deec358
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Thu Jul 24 12:40:29 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/cd5c9600321bf250f4061acce65747536deec358 [^]

Fixed issue 27162. Two changes have been made:
- A new uuid generation method has been included. This new method will work much better, and should not produce duplicated ids.
- An additional check has been added, in case the id of the new ticket corresponds to the id of an existing ticket. In this case, the document numbers will be compared to verify that the tickets are indeed the same, and otherwise, the new ticket will be saved as an error instead of being discarded.

---
M src/org/openbravo/retail/posterminal/OrderLoader.java
---
(0068862)
hgbot   
2014-07-24 12:48   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 891cc7b85af7e733e33b84eb993b491f48b959bd
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Thu Jul 24 12:47:47 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/891cc7b85af7e733e33b84eb993b491f48b959bd [^]

Related to issue 27162. Fixed jslint warnings

---
M web/org.openbravo.mobile.core/source/data/ob-dal.js
---
(0068867)
Orekaria   
2014-07-24 13:55   
Revised and Tested with DuplicatedTicketAreSavedProperly and EquivalentTicketsSavedCorrectly
(0068872)
Orekaria   
2014-07-24 17:25   
Test created: I27162_GetuuidFailsToBeUnique
Although this test generates only 100.000 random ids, it will be able to probe the uniqueness in a long period of time.
If this test fails more than once in a very long time... the algorithm is failing to be unique and should be revisited
(0069036)
hgbot   
2014-08-01 16:45   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 04dab10f54aeaa38134523d6ea634edb585a8551
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Fri Aug 01 16:45:07 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/04dab10f54aeaa38134523d6ea634edb585a8551 [^]

Related to issue 27162. Small changes after code-review

---
M src/org/openbravo/retail/posterminal/OrderLoader.java
---