Openbravo Issue Tracking System - Retail Modules
View Issue Details
0038007Retail ModulesWeb POSpublic2018-02-27 11:392018-03-01 10:14
marvintm 
marvintm 
urgentmajoralways
closedfixed 
5
 
 
migueldejuana
No
0038007: LogClient can generate too many useless requests if server is struggling
Currently, the logclient is sent every 30 seconds, and the request has a timeout of 20 seconds. Normally, this is fine, and there is more than enough time to send even the maximum page size in these 20 seconds.

However, sometimes the backend server may be struggling for some other reason, or the bandwidth in the store may not be enough, and finally the request cannot be completed in this time. In this case, as the interval is currently 30 seconds, the terminal will every 30 seconds send another request, which most likely will also fail, thus eventually flooding the server with these requests, and wasting a significant amount of network bandwidth and server resources.

We don't want to change the interval because in normal cases we want to send the logclient information as soon as possible. However, we can increase the timeout of the logclient by default, and the terminal should behave smartly and should not generate another request if the previous one is still being processed.

With these two changes, the terminal will no longer flood the server with requests in case it's struggling, but instead will automatically adjust itself, and stop sending the logclient information if the server is not able to absorb it.
- Create a problem in the server when accepting the logclient (for example, add a breakpoint in LogClientLoader class, or artificially reduce the available bandwidth very significantly).
- Wait for the logclient request. Verify that it fails due to timeout.
- Verify that 10 seconds, later, another request is done, which will also fail in 20 seconds, and 10 seconds later another one will be done, and 20 seconds later it will fail, ...

This was the intended behaviour, but we have now seen that this can create significant problems in an already struggling server,
- Timeout in logclient request will be significantly increased.
- LogClient process in the terminal will be changed, so that if there is a pending request, a new request will not be triggered, and instead the process will wait for the next cycle to check if a new request can now be done.
Performance
related to defect 0037851 closed marvintm Request timeout should apply to the whole process, and not just the query 
Issue History
2018-02-27 11:39marvintmNew Issue
2018-02-27 11:39marvintmAssigned To => Retail
2018-02-27 11:39marvintmTriggers an Emergency Pack => No
2018-02-27 11:40marvintmDescription Updatedbug_revision_view_page.php?rev_id=16780#r16780
2018-02-27 11:40marvintmDescription Updatedbug_revision_view_page.php?rev_id=16781#r16781
2018-02-27 11:41marvintmDescription Updatedbug_revision_view_page.php?rev_id=16782#r16782
2018-02-27 11:58alostaleTag Attached: Performance
2018-02-27 11:59alostaleRelationship addedrelated to 0037851
2018-02-27 13:36marvintmStatusnew => scheduled
2018-02-27 13:36marvintmAssigned ToRetail => marvintm
2018-02-28 11:31hgbotCheckin
2018-02-28 11:31hgbotNote Added: 0102867
2018-02-28 11:31hgbotStatusscheduled => resolved
2018-02-28 11:31hgbotResolutionopen => fixed
2018-02-28 11:31hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/ea367b131377f87ea1a88d16b0e8474e761785fb [^]
2018-02-28 11:33marvintmReview Assigned To => migueldejuana
2018-02-28 17:09hgbotCheckin
2018-02-28 17:09hgbotNote Added: 0102873
2018-02-28 17:14migueldejuanaNote Added: 0102875
2018-02-28 17:14migueldejuanaStatusresolved => closed
2018-03-01 10:14alostaleIssue Monitored: alostale

Notes
(0102867)
hgbot   
2018-02-28 11:31   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: ea367b131377f87ea1a88d16b0e8474e761785fb
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Tue Feb 27 17:53:10 2018 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/ea367b131377f87ea1a88d16b0e8474e761785fb [^]

Fixed issue 38007. LogClient will now generate less useless requests. Two main changes have been made:
- Default timeout of the LogClientLoader request has been significantly increased (from 20 seconds, to 5 minutes).
- Now the LogClientLoader request will no longer happen if there is already a request which is not yet finished. Instead, we will do nothing, and the next cycle (so by default 30 seconds later) the system will check again if the request finished, and a new one can be done.
With these two changes, the LogClientLoader requests will work exactly as before if the network and server are fine. However, if the network doesn't have enough bandwidth, or the server is struggling, and the request takes longer than usual, now the request will no longer be canceled, and instead the system will wait for it to finish, instead of canceling it and relaunching it again in the next 30 seconds. This should greatly reduce the number of useless requests which are then canceled, when the system is struggling.

---
M src-db/database/sourcedata/OBMOBC_SERVICES.xml
M web/org.openbravo.mobile.core/source/utils/logClientSyncUtils.js
---
(0102873)
hgbot   
2018-02-28 17:09   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: dce34f05751e5d866f92b2166e4442ca20586292
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Wed Feb 28 17:09:07 2018 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/dce34f05751e5d866f92b2166e4442ca20586292 [^]

Related to issue 38007. Added check also in OB.UTIL.processLogClients function just in case somebody calls it directly

---
M web/org.openbravo.mobile.core/source/utils/logClientSyncUtils.js
---
(0102875)
migueldejuana   
2018-02-28 17:14   
Tested and reviewed