Openbravo Issue Tracking System - Retail Modules
View Issue Details
0038390Retail ModulesWeb POSpublic2018-04-17 13:022018-05-21 10:06
alostale 
marvintm 
normalminorhave not tried
closedfixed 
5
 
RR18Q3 
guilleaer
No
0038390: request timeout is checked only after reading the whole request content
While reading request content it is checked whether the request has timed out on after each line is read to stop processing if so (see 0037851).

In most of the cases (ie. LogClient) the whole content is represented as a single line, which makes this part of the fix useless as in practice it only will time out after reading the whole request content.
1. Log in WebPOS
2. Simulate slow network by setting browser's network throttilng (set to something really slow)
3. Generate big log client to be sent, ie. execute:
  for (var i =0;i<500;i++) {
    var s = i + '-'
    for (var j=0; j<4096; j++) s += 'c'
    OB.warn(s)
  }
4. Wait till log client is sent to backend
  -> Check the request is detected as timed out only after the whole content is read
Instead of reading the request line by line, do it using a fixed buffer size to be able to check timeout in a more frequent basis.
Performance
related to defect 0037851 closed marvintm Request timeout should apply to the whole process, and not just the query 
related to defect 0038389 closed marvintm DB connection unnecessarily retained while reading request contents 
? 38390.export (2,878) 2018-04-17 13:08
https://issues.openbravo.com/file_download.php?file_id=11743&type=bug
Issue History
2018-04-17 13:02alostaleNew Issue
2018-04-17 13:02alostaleAssigned To => Retail
2018-04-17 13:02alostaleTriggers an Emergency Pack => No
2018-04-17 13:03alostaleRelationship addedrelated to 0037851
2018-04-17 13:03alostaleRelationship addedrelated to 0038389
2018-04-17 13:03alostaleTag Attached: Performance
2018-04-17 13:08alostaleFile Added: 38390.export
2018-04-17 13:09alostaleNote Added: 0103935
2018-05-04 13:10hgbotCheckin
2018-05-04 13:10hgbotNote Added: 0104281
2018-05-04 13:10hgbotStatusnew => resolved
2018-05-04 13:10hgbotResolutionopen => fixed
2018-05-04 13:10hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/0e18b8cfd67f408e753b45a207a081f24bc07c93 [^]
2018-05-04 15:25marvintmAssigned ToRetail => marvintm
2018-05-21 10:06guilleaerReview Assigned To => guilleaer
2018-05-21 10:06guilleaerStatusresolved => closed
2018-05-21 10:06guilleaerFixed in Version => RR18Q3

Notes
(0103935)
alostale   
2018-04-17 13:09   
Attached proposed fix.

Pending to be tested, specially:

* Compare performance with previous implementation
* Ensure it works properly (ie. ensure encoding is correct, etc.)
(0104281)
hgbot   
2018-05-04 13:10   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 0e18b8cfd67f408e753b45a207a081f24bc07c93
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Thu May 03 18:43:26 2018 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/0e18b8cfd67f408e753b45a207a081f24bc07c93 [^]

fixed 38390: request timeout is checked after reading the whole request content

  * Now request is read in chunks of 4096 characters (this size is the same as the
    one that was already being used in Tomcat's CoyoteReader.readLine) instead of
    line by line.
  * After each chunk time out is checked.
  * Additionally, prevent generating debugging potentially big String if it's not
    going to be used.

---
M src/org/openbravo/mobile/core/process/WebServiceAuthenticatedServlet.java
---