Openbravo Issue Tracking System - Retail Modules
View Issue Details
0036649Retail ModulesWeb POSpublic2017-08-14 13:492017-12-22 13:22
malsasua 
marvintm 
highmajorsometimes
closedfixed 
5
 
 
migueldejuana
No
0036649: slow networking: logout is done and "Session for the ERP already exists..." message is displayed
when networking is slow, and refresh (F5) is done, logout is done and when you try to do login again, message is displayed:
"Session for the ERP already exists You have already logged in the ERP in this browser. Therefore, you cannot log in. If the ERP session is valid for this application, you only need to refresh the page. If not, you need to log out of the ERP before you can log in."
(randomly)
. do login
. configure chrome to simulate slow networking (gprs)
. refresh browser
logout is done.
. do login:
error message is displayed: "Session for the ERP already exists You have already logged in the ERP in this browser. Therefore, you cannot log in. If the ERP session is valid for this application, you only need to refresh the page. If not, you need to log out of the ERP before you can log in."
No tags attached.
depends on design defect 0037271 new Retail Web POS offline behaviour should be improved 
Not all the children of this issue are yet resolved or closed.
Issue History
2017-08-14 13:49malsasuaNew Issue
2017-08-14 13:49malsasuaAssigned To => Retail
2017-08-14 13:49malsasuaResolution time => 1504562400
2017-08-14 13:49malsasuaTriggers an Emergency Pack => No
2017-09-06 18:18gorka_gilNote Added: 0098871
2017-09-06 18:19gorka_gilAssigned ToRetail => gorka_gil
2017-09-06 18:19gorka_gilStatusnew => acknowledged
2017-09-07 16:35gorka_gilAssigned Togorka_gil => Retail
2017-09-07 16:47gorka_gilNote Added: 0098890
2017-09-11 10:44marvintmResolution time1504562400 =>
2017-09-11 10:44marvintmTypedefect => design defect
2017-09-11 10:44marvintmRelationship addeddepends on 0036822
2017-11-09 18:51marvintmRelationship addeddepends on 0037271
2017-11-09 18:52marvintmRelationship deleteddepends on 0036822
2017-11-09 20:11marvintmStatusacknowledged => scheduled
2017-11-09 20:11marvintmAssigned ToRetail => marvintm
2017-12-01 10:05hgbotCheckin
2017-12-01 10:05hgbotNote Added: 0100856
2017-12-01 10:05hgbotStatusscheduled => resolved
2017-12-01 10:05hgbotResolutionopen => fixed
2017-12-01 10:05hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/4a3a5cc1a54b35b9d6789173cbec5cf7c0564d9c [^]
2017-12-22 13:22migueldejuanaReview Assigned To => migueldejuana
2017-12-22 13:22migueldejuanaNote Added: 0101233
2017-12-22 13:22migueldejuanaStatusresolved => closed

Notes
(0098871)
gorka_gil   
2017-09-06 18:18   
Reproducible in current pi (6 Sep 2017 - future 17q4) with chrome 60.

Note in chrome 60 there is not gprs profile, needed to create a custom one with:
 Up: 50 (kb/s) , Down: 50 (kb/s) , Latency 500 (ms)
(0098890)
gorka_gil   
2017-09-07 16:47   
Started with this issue, but because of the complexity left for another developer with more experience to finish it.

Analyzed till now:

a) First problem is that the check of the erp session active prevents to create a new session, to fix that:


diff -r 9273d52d35d5 src/org/openbravo/mobile/core/login/MobileCoreLoginHandler.java
--- a/src/org/openbravo/mobile/core/login/MobileCoreLoginHandler.java Tue Sep 05 16:31:28 2017 -0400
+++ b/src/org/openbravo/mobile/core/login/MobileCoreLoginHandler.java Thu Sep 07 16:36:24 2017 +0200
@@ -212,7 +213,8 @@
     OBContext.setAdminMode(false);
     Session session = OBDal.getInstance().get(Session.class, id);
     try {
- return (session != null && session.isSessionActive());
+ return (session != null && session.isSessionActive() && RequestContext.get()
+ .getSessionAttribute("POSTerminal") == null);
     } finally {
       OBContext.restorePreviousMode();
     }

b) After that, is failing after the login:
- it goes offline, then back online and in a looks like has lost the context:

postSyncProcessActions: function() {
            if (OB.MobileApp.model.get('context').user [....]
TypeError: Cannot read property 'user' of null


Note: increasing this timeout:
            url: this.get('loginUtilsUrl'),
            cacheBust: false,
            timeout: 5000,
to 20000, fix the problem b) but we don't want to increase this timeout, since it will be less responsible to change to offline status.
(0100856)
hgbot   
2017-12-01 10:05   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 4a3a5cc1a54b35b9d6789173cbec5cf7c0564d9c
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Thu Nov 09 20:11:33 2017 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/4a3a5cc1a54b35b9d6789173cbec5cf7c0564d9c [^]

Fixed issue 36649. [OfflineImprovements] Login will be more reliable in bad networks. Three changes have been made:
- POSLoginHandler will no longer reject the request for new session when session already exists. This will solve the problem of POSLoginHandler request giving timeout, and then failing on second try due to the session already existing in the backend.
- Reduced timeout of org.openbravo.mobile.core.context request to improve responsiveness
- Now if preRenderActions request fails due to timeout or other reason, an attempt to execute offline login will be done. This will only work if the user really inserted user/password, otherwise a navigation to login page will be done as we lack sufficient information to do offline login.

---
M src/org/openbravo/mobile/core/login/MobileCoreLoginHandler.java
M web/org.openbravo.mobile.core/source/model/ob-terminal-model.js
---
(0101233)
migueldejuana   
2017-12-22 13:22   
Reviewed