Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0050314
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[POS2] Coremajorhave not tried2022-09-22 16:212022-10-11 12:25
ReportercbernerView Statuspublic 
Assigned Tocberner 
PrioritynormalResolutionfixedFixed in Version23Q1
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned ToAugustoMauch
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0050314: State compression on occasions breaks the state on deployed pos2

DescriptionIf we refresh pos2 without any previous state and no data of the application, it breaks with the following error continuously appearing in the terminal:
TypeError: Cannot read properties of undefined (reading 'length')
    at Object.checkMaximumNumberEventsPerMessage (POS2.js:16745:30)

If we take a look at the state after this happens, we encounter a state that is semi-compressed, and this seems to be the thing that's generating that error. It is not very clear what is causing it, for now we know is not the service workers, as this also happens on locally node deployed pos2.

Check the attached screenshot and video for more details.
Steps To Reproduce1. Go to pos2 in livebuilds: https://livebuilds.openbravo.com/retail_pos2_pgsql/web/pos/?terminal=VBS-2 [^]
2. Open developer tools in chrome, and go to tab "Application"
3. Click on the left, click on Storage, and then on the button "Clear site data"

Refresh the web, you should reproduce the problem. Check the attached gif for extra info.
TagsNo tags attached.
Attached Filespng file icon errorCompression.png [^] (112,986 bytes) 2022-09-22 16:21


png file icon semiCompressedState.png [^] (264,496 bytes) 2022-09-22 16:21
gif file icon errorsCompression.gif [^] (1,398,761 bytes) 2022-09-22 16:22

- Relationships Relation Graph ] Dependency Graph ]
depends on backport 0050478RR22Q4.1 closedcberner Retail Modules State compression on occasions breaks the state on deployed pos2 
depends on backport 0050479RR22Q3.2 closedcberner Retail Modules State compression on occasions breaks the state on deployed pos2 

-  Notes
(0141581)
andre_montenegro (developer)
2022-10-03 16:14

This issue also affects Cypress tests when executing 2 different test which need to refresh page (not singleLogin related). So, for now and until the issue is fixed, cashup and login tests will be skipped: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/1238 [^]
(0141722)
cberner (developer)
2022-10-06 12:02

Some extra research has been done for this issue. We know where it happens:
https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/blob/master/web/org.openbravo.mobile.core/app/model/application-state/StatePersistence.js#L266 [^]

When cache is cleared through devtools and we're still in the login screen, it will persist the state but without updating the localstorage property "statePersistenceMethod", which results in the system thinking there's a state, but it is not compressed, when indeed it is compressed.

On refresh, it will break because it will assume a non-compressed state, while it is actually compressed. I'm still working on finding a proper solution for this.
(0141849)
hgbot (developer)
2022-10-07 11:46

Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/419 [^]
(0141933)
hgbot (developer)
2022-10-10 18:52

Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core [^]
Changeset: d2cd412b1fcf55901e3f897bbe9f583170b29d01
Author: Cristian Berner <cristian.berner@openbravo.com>
Date: 10-10-2022 18:52:03
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/commit/d2cd412b1fcf55901e3f897bbe9f583170b29d01 [^]

Fixes ISSUE-50314: State persistence compression breaks in occasions on pos2

This was due to how the compressed state is saved in the localstorage.
If the localstorage is cleaned while in the application, being it in the
login screen or in another part of the application, that would result in
the state being persisted just after clearing localstorage.

After a refresh, this state saved in the localstorage would result in an
error, because we would try to compress the already compressed state
again, which is wrong. To fix this, we're checking if the property in
the state "isGlobalState" exists and is of boolean type, then the state
is not compressed. We can assume this, because the property is always
available as part of the main state and when compressed it is a string
instead of a boolean variable.

---
M web/org.openbravo.mobile.core/app/model/application-state/StatePersistence.js
---
(0141934)
hgbot (developer)
2022-10-10 18:52

Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/419 [^]

- Issue History
Date Modified Username Field Change
2022-09-22 16:21 cberner New Issue
2022-09-22 16:21 cberner Assigned To => Triage Platform Base
2022-09-22 16:21 cberner File Added: errorCompression.png
2022-09-22 16:21 cberner Triggers an Emergency Pack => No
2022-09-22 16:21 cberner File Added: semiCompressedState.png
2022-09-22 16:22 cberner File Added: errorsCompression.gif
2022-10-03 16:14 andre_montenegro Note Added: 0141581
2022-10-06 12:02 cberner Note Added: 0141722
2022-10-07 11:46 hgbot Note Added: 0141849
2022-10-07 13:46 cberner Assigned To Triage Platform Base => cberner
2022-10-07 13:46 cberner Status new => scheduled
2022-10-10 18:52 hgbot Resolution open => fixed
2022-10-10 18:52 hgbot Status scheduled => closed
2022-10-10 18:52 hgbot Fixed in Version => RR23Q1
2022-10-10 18:52 hgbot Note Added: 0141933
2022-10-10 18:52 hgbot Note Added: 0141934
2022-10-11 12:23 cberner Status closed => new
2022-10-11 12:23 cberner Resolution fixed => open
2022-10-11 12:23 cberner Fixed in Version RR23Q1 =>
2022-10-11 12:24 cberner Status new => scheduled
2022-10-11 12:25 cberner Status scheduled => resolved
2022-10-11 12:25 cberner Fixed in Version => 23Q1
2022-10-11 12:25 cberner Resolution open => fixed
2022-10-11 12:25 cberner Review Assigned To => AugustoMauch
2022-10-11 12:25 cberner Status resolved => closed


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker