Openbravo Issue Tracking System - Retail Modules
View Issue Details
0028539Retail ModulesWeb POSpublic2015-01-08 10:502015-03-27 12:33
aaroncalero 
aaroncalero 
normalminorsometimes
closedfixed 
5
 
RR15Q2RR15Q2 
Orekaria
No
0028539: If syncAllModels is called before a previous execution has finished, the same data is sent twice to the server
If syncAllModels is called before a previous execution has finished and the data is not synchronized yet (OB.MobileApp.model.dataSynchronized is false), the same data is sent to the backend twice and the second time the data is being processed, several server errors are raised.
Create several tickets (30+) in webPOS while in offline mode.
Conect again to the server.
Before the synchronization process has finished, create a new ticket.
The following error will raise on the server:
*postgres database
2015-01-07 18:34:06,869 [TP-Processor5] ERROR org.hibernate.util.JDBCExceptionReporter - Batch entry 0 insert into C_Order (AD_Client_ID, AD_Org_ID, IsActive, CreatedBy, Updated, UpdatedBy, IsSOTrx, DocumentNo, DocStatus, DocAction, Processing, Processed, C_DocType_ID, C_DocTypeTarget_ID, Description, IsDelivered, IsInvoiced, IsPrinted, IsSelected, SalesRep_ID, DateOrdered, DatePromised, DateAcct, C_BPartner_ID, BillTo_ID, C_BPartner_Location_ID, IsDiscountPrinted, C_Currency_ID, PaymentRule, C_PaymentTerm_ID, InvoiceRule, DeliveryRule, FreightCostRule, DeliveryViaRule, ChargeAmt, PriorityRule, TotalLines, GrandTotal, M_Warehouse_ID, M_PriceList_ID, IsTaxIncluded, Posted, AD_User_ID, CopyFrom, IsSelfService, Generatetemplate, CopyFromPO, FIN_Paymentmethod_ID, RM_PickFromShipment, RM_ReceiveMaterials, RM_CreateInvoice, RM_AddOrphanLine, Calculate_Promotions, Convertquotation, Create_POLines, EM_Obdisc_Addpack, Iscashvat, RM_Pickfromreceipt, EM_APRM_AddPayment, EM_Obpos_Applications_ID, EM_Obpos_App_Cashup_ID, EM_Obpos_Sendemail, EM_Obpos_Createdabsolute, C_Order_ID) values ('39363B0921BB4293B48383844325E84C', 'D270A5AC50874F8BA67A88EE977F8E3B', 'Y', '3073EDF96A3C42CC86C7069E379522D2', '2015-01-07 18:34:06.129000 +00:00:00', '3073EDF96A3C42CC86C7069E379522D2', 'Y', 'VBS1/0000624', 'CO', '--', 'N', 'Y', '511A9371A0F74195AA3F6D66C722729D', '511A9371A0F74195AA3F6D66C722729D', '', 'N', 'N', 'Y', 'N', '3073EDF96A3C42CC86C7069E379522D2', '2015-01-07 00:00:00.000000 +00:00:00', '2015-01-07 00:00:00.000000 +00:00:00', '2015-01-07 00:00:00.000000 +00:00:00', 'ABD91C9D3BC94175B876FBBE9CACA008', '2AA7EADDF7EC405899262DDA3E572436', '2AA7EADDF7EC405899262DDA3E572436', 'N', '102', 'B', 'D8955F8808A54C63BBF478A6843D834D', 'I', 'A', 'I', 'P', '0', '5', '201.58', '243.90', 'CE7AB151695342FF879938F837F12E6E', '496CF965DF9744D2A41248392D1DE407', 'Y', 'N', '032576220FC44B0DA80145B3265E4D9A', 'N', 'N', 'N', 'N', '45A202BF44884F05B8A1BF741E2063B6', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', '9104513C2D0741D4850AE8493998A7C8', 'D2B699745521589F3A4F3ADAF0982E34', 'N', '2015-01-07 18:34:03.396000 +00:00:00', '18E7A199C39CB15BD5D1F8EA42DFCFD7') was aborted. Call getNextException to see the cause.
2015-01-07 18:34:06,877 [TP-Processor5] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: duplicate key value violates unique constraint "c_order_key"

*oracle database
2015-01-05 16:13:43,984 [TP-Processor1] ERROR org.hibernate.util.JDBCExceptionReporter - ORA-00001: unique constraint (RET_TEST_ORACLE.C_ORDER_KEY) violated
We need to ensure that the syncAllModels function is not executed in parallel.
If it is called while the synchronization is in progress (meaning that there is something else that should be sync'ed), we need to activate a flag to call syncAllModels again after the first execution has finished.
No tags attached.
duplicate of defect 0029290 closed Orekaria Stabilization: The 'OB.MobileApp.model.syncAllModels' process should be executed once 
depends on feature request 0028217 new Retail Stabilization: Create a basic API for the asynchronous calls 
related to defect 0028692 closed migueldejuana Message about Data Synchronization is shown before the actual synchronization happens 
Not all the children of this issue are yet resolved or closed.
Issue History
2015-01-08 10:50aaroncaleroNew Issue
2015-01-08 10:50aaroncaleroAssigned To => aaroncalero
2015-01-08 10:50aaroncaleroTriggers an Emergency Pack => No
2015-01-08 11:46hgbotCheckin
2015-01-08 11:46hgbotNote Added: 0073352
2015-01-08 11:46hgbotStatusnew => resolved
2015-01-08 11:46hgbotResolutionopen => fixed
2015-01-08 11:46hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/368bb8e4468a326c5b1c4e749fb85ff9d9c7fe7d [^]
2015-01-12 13:01OrekariaNote Added: 0073419
2015-01-12 13:01OrekariaStatusresolved => new
2015-01-12 13:01OrekariaResolutionfixed => open
2015-01-12 13:04OrekariaNote Edited: 0073419bug_revision_view_page.php?bugnote_id=0073419#r7421
2015-01-12 13:06OrekariaNote Edited: 0073419bug_revision_view_page.php?bugnote_id=0073419#r7422
2015-01-15 08:09hgbotCheckin
2015-01-15 08:09hgbotNote Added: 0073507
2015-01-20 16:00OrekariaRelationship addedrelated to 0028692
2015-01-20 16:03OrekariaRelationship addeddepends on 0028217
2015-01-20 16:06OrekariaRelationship deletedrelated to 0028692
2015-01-20 16:07OrekariaRelationship addedrelated to 0028692
2015-03-27 08:56aaroncaleroRelationship addedduplicate of 0029290
2015-03-27 12:33OrekariaReview Assigned To => Orekaria
2015-03-27 12:33OrekariaStatusnew => closed
2015-03-27 12:33OrekariaResolutionopen => fixed
2015-03-27 12:33OrekariaFixed in Version => RR15Q2

Notes
(0073352)
hgbot   
2015-01-08 11:46   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 368bb8e4468a326c5b1c4e749fb85ff9d9c7fe7d
Author: Aaron Calero <aaron.calero <at> openbravo.com>
Date: Thu Jan 08 10:59:38 2015 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/368bb8e4468a326c5b1c4e749fb85ff9d9c7fe7d [^]

Fixed issue 28539: If syncAllModels is called before a previous execution has finished, the same data is sent twice to the server

Added an if condition to check if the dataSynchronized variable is true. If it's true, we can safely call syncModel to synchronize all data; if it's false, we activate the synchronizationPending flag to call syncAllModels again after the first execution has finished.

---
M web/org.openbravo.mobile.core/source/model/ob-terminal-model.js
---
(0073419)
Orekaria   
2015-01-12 13:01   
(edited on: 2015-01-12 13:06)
Complex nested asynchronous calls and semaphores without the proper structure lead to hidden, hard to diagnose, breaking flow behaviour

As the SynchronizationHelper was born to address this flow requirements, that class should be improved to house this particular use case (the status of the server synchronization). The 'dataSynchronized' variable would be substituted (it wasn't possible due to Q1 time constraints)

(0073507)
hgbot   
2015-01-15 08:09   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 39cc6c6da0fcc9c333fece0859d17933617643b2
Author: Rafa Alonso <rafael.alonso <at> openbravo.com>
Date: Tue Jan 13 11:02:28 2015 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/39cc6c6da0fcc9c333fece0859d17933617643b2 [^]

Related to issue 28539: Backed out changeset: 368bb8e4468a, rev 1111
- this changeset seems to provoke webpos hangs when synchronizing

---
M web/org.openbravo.mobile.core/source/model/ob-terminal-model.js
---