[dolphin][FTU]interruption of power supply before choosing language in ftu when reset phone,buttons in dockbar and collection is disappear

RESOLVED WONTFIX

Status

Firefox OS
Gaia::Homescreen
--
blocker
RESOLVED WONTFIX
3 years ago
3 years ago

People

(Reporter: ben.song, Assigned: yifan, NeedInfo)

Tracking

unspecified
ARM
Gonk (Firefox OS)

Firefox Tracking Flags

(blocking-b2g:-, b2g-v1.4 affected)

Details

Attachments

(2 attachments, 2 obsolete attachments)

(Reporter)

Description

3 years ago
Immediately interruption of power supply before choosing language in ftu when reset phone,buttons in dockbar and collection is disappear,the background is exist.
(Reporter)

Comment 1

3 years ago
Base on this problem,we find save data of homescreen into indexedDB has been interruption when interruption of power supply before changing language in ftu.So we could get db files of homescreen in /data/local/storage/persistent/1022+f+app+++homescreen.gaiamobile.org/idb has been lost or changed through execution instruction adb shell.
Flags: needinfo?(pehrsons)
Flags: needinfo?(janjongboom)
Ben, please attach your patch here.
status-b2g-v1.4: --- → affected
Summary: interruption of power supply before choosing language in ftu when reset phone,buttons in dockbar and collection is disappear → [dolphin][FTU]interruption of power supply before choosing language in ftu when reset phone,buttons in dockbar and collection is disappear
qawanted on non-Dolphin devices.
Flags: needinfo?(sergi.mansilla)
Keywords: qawanted
(Reporter)

Comment 4

3 years ago
In state.js of homescreen module we find function st_init would get data from indexedDB,and at the start,it would check the db if empty,if true,it would invoke function loadInitialState to save new data into indexedDB;if not,it would get data Immediately.
But in the process of interruption of power supply,homescreen began to render and save it's data into indexed,so the save of data would incomplete with a certain probability.
status-b2g-v1.4: affected → ---
Keywords: qawanted
Summary: [dolphin][FTU]interruption of power supply before choosing language in ftu when reset phone,buttons in dockbar and collection is disappear → interruption of power supply before choosing language in ftu when reset phone,buttons in dockbar and collection is disappear
(Reporter)

Updated

3 years ago
Summary: interruption of power supply before choosing language in ftu when reset phone,buttons in dockbar and collection is disappear → [dolphin][FTU]interruption of power supply before choosing language in ftu when reset phone,buttons in dockbar and collection is disappear
(Reporter)

Comment 5

3 years ago
Created attachment 8488539 [details] [diff] [review]
homescreen.patch
Attachment #8488539 - Flags: review?(james.zhang)
(Reporter)

Comment 6

3 years ago
[Blocking Requested - why for this release]:
blocking-b2g: --- → 1.4?
QA Whiteboard: qawanted
(Reporter)

Comment 7

3 years ago
When this problem occurs we find document 1694510209hnoemeersc and file 1694510209hnoemeersc.sqlite-journal been lost, file 1694510209hnoemeersc.sqlite and 3350367306aesgyanrcoSt.sqlite been changed in /data/local/storage/persistent/1022+f+app+++homescreen.gaiamobile.org/idb.
Attachment #8488539 - Flags: review?(james.zhang) → review?(janjongboom)
(In reply to Jan Jongboom [:janjongboom] (Telenor) from comment #3)
> qawanted on non-Dolphin devices.

You can delete 1694510209hnoemeersc and 1694510209hnoemeersc.sqlite-journal in /data/local/storage/persistent/1022+f+app+++homescreen.gaiamobile.org/idb on flame to reproduce this issue.
Flags: needinfo?(kevin)
Comment on attachment 8488539 [details] [diff] [review]
homescreen.patch

Redirecting to Vivien for review.
Attachment #8488539 - Flags: review?(janjongboom) → review?(21)
Flags: needinfo?(janjongboom)
Flags: needinfo?(pehrsons)
(Assignee)

Comment 10

3 years ago
(In reply to ben.song from comment #4)
> In state.js of homescreen module we find function st_init would get data
> from indexedDB,and at the start,it would check the db if empty,if true,it
> would invoke function loadInitialState to save new data into indexedDB;if
> not,it would get data Immediately.
> But in the process of interruption of power supply,homescreen began to
> render and save it's data into indexed,so the save of data would incomplete
> with a certain probability.

Thank you Ben for the explanation and the fix. There is a flag 'emptyDB' which is used for checking if the IndexedDB of name 'homescreen' exists. The steps for the first time homescreen is launching are as follows:

1. open IndexedDB (emptyDB is false)
2. onupgradeneeded event (if event.oldversion is 0, set emptyDB to true and create an objectStore named 'grid')
3. onsuccess event (if emptyDB is true, loadInitialState)

If power is off between step 2 and 3, when power is on the next time 'loadInitialState' might not be running since in the onupgradeneeded event the event.oldversion > 0 and the emptyDB flag will never be true. Same applies to verticalhome.
(Assignee)

Updated

3 years ago
See Also: → bug 1067720
(Assignee)

Comment 11

3 years ago
Hi Ben,

Instead of putting the checking flag in mozSettings, could you please try moving it from mozSettings to somewhere like localStorage? Since it's only applicable in homescreen app, we think it might not be mandatory to be saved in mozSettings.
Flags: needinfo?(ben.song)
(Reporter)

Comment 12

3 years ago
(In reply to Yi-Fan Liao [:yifan][:yliao] from comment #11)
> Hi Ben,
> 
> Instead of putting the checking flag in mozSettings, could you please try
> moving it from mozSettings to somewhere like localStorage? Since it's only
> applicable in homescreen app, we think it might not be mandatory to be saved
> in mozSettings.

Hi Yi-Fan,

   But if homescreen be killed or phone be restart ,whether this localstorage would be clean ?
Flags: needinfo?(ben.song)
(Assignee)

Comment 13

3 years ago
It is persistent so the value you saved will be retained for the homescreen app.
(Reporter)

Comment 14

3 years ago
(In reply to Yi-Fan Liao [:yifan][:yliao] from comment #13)
> It is persistent so the value you saved will be retained for the homescreen
> app.
Hi Yi-Fan,

Do you mean window.localStorage?Thanks.
(Assignee)

Comment 15

3 years ago
Yes, you might have seen this on MDN: https://developer.mozilla.org/en/docs/Web/Guide/API/DOM/Storage#localStorage .
(Reporter)

Comment 16

3 years ago
Created attachment 8489819 [details] [diff] [review]
new.patch

Hi Yi-Fan,

   I have updated this patch with what you said.Please review it.Thanks.
Attachment #8489819 - Flags: review?(yliao)
Flags: needinfo?(yliao)
(Assignee)

Comment 17

3 years ago
Created attachment 8489846 [details] [review]
pull request

Thank you Ben for the fix! Here's the PR to be reviewed for v1.4.

* Add a homescreen IndexedDB check flag in localStorage to prevent grid initialization failure due to unexpected power off.
Attachment #8488539 - Attachment is obsolete: true
Attachment #8489819 - Attachment is obsolete: true
Attachment #8488539 - Flags: review?(21)
Attachment #8489819 - Flags: review?(yliao)
Attachment #8489846 - Flags: review?(21)
Flags: needinfo?(yliao)
(Assignee)

Updated

3 years ago
status-b2g-v1.4: --- → affected

Comment 18

3 years ago
Dear Rachelle,
Plz help to push this patch review ,Thanks.
Flags: needinfo?(wchang)
Flags: needinfo?(ryang)
Attachment #8489846 - Flags: review?(21) → review?(crdlc)
Comment on attachment 8489846 [details] [review]
pull request

I think that you have to use the asyncStorage because localStorage is synchronous and slower. What do you think? Thanks
Attachment #8489846 - Flags: review?(crdlc)
(Reporter)

Comment 20

3 years ago
(In reply to Cristian Rodriguez (:crdlc) from comment #19)
> Comment on attachment 8489846 [details] [review]
> pull request
> 
> I think that you have to use the asyncStorage because localStorage is
> synchronous and slower. What do you think? Thanks

Hi  Cristian,

   OK,Does it work in this bug,because I have't used this object of asyncStorage.Thank.
Yes, the library is available 

https://github.com/begeeben/gaia/blob/1066492_interruption_of_power/apps/homescreen/index.html#L18

The difference is that this is asynchronous

https://github.com/begeeben/gaia/blob/1066492_interruption_of_power/shared/js/async_storage.js
I see review is active now. I don't see this as a blocker for 1.4 given the circumstances and the chances of this happening.

We should make sure the solution is given time to be refined instead of rushing it into a time pressured release.
blocking-b2g: 1.4? → -
Flags: needinfo?(wchang)
(Reporter)

Comment 23

3 years ago
(In reply to Cristian Rodriguez (:crdlc) from comment #21)
> Yes, the library is available 
> 
> https://github.com/begeeben/gaia/blob/1066492_interruption_of_power/apps/
> homescreen/index.html#L18
> 
> The difference is that this is asynchronous
> 
> https://github.com/begeeben/gaia/blob/1066492_interruption_of_power/shared/
> js/async_storage.js

Hi Cristian,

  I would updated new.patch as your said.Thanks
(Reporter)

Comment 24

3 years ago
Created attachment 8490499 [details] [diff] [review]
update.patch

Hi Cristian,

   This is the updated patch,can you help me to review it? Thanks.
Attachment #8490499 - Flags: review?(crdlc)
(Assignee)

Comment 25

3 years ago
Comment on attachment 8489846 [details] [review]
pull request

Thanks for pointing it out! And thank you Ben for the help. The change from localStorage to asyncStorage is updated in the PR.
Attachment #8489846 - Flags: review?(crdlc)
Comment on attachment 8490499 [details] [diff] [review]
update.patch

Review of attachment 8490499 [details] [diff] [review]:
-----------------------------------------------------------------

https://github.com/begeeben/gaia/blob/1066492_interruption_of_power/shared/js/async_storage.js#L25

getItem sends the value as parameter in a callback
Attachment #8490499 - Flags: review?(crdlc) → review-
Comment on attachment 8489846 [details] [review]
pull request

LGTM, I left a comment on github
Attachment #8489846 - Flags: review?(crdlc) → review+
(Assignee)

Comment 28

3 years ago
Thank you! Sorry for the mistake, fixed in the PR.
Patch ready,clear ni.
Flags: needinfo?(ryang)
Flags: needinfo?(kevin)
(Assignee)

Updated

3 years ago
See Also: → bug 1143526
(Assignee)

Updated

3 years ago
Assignee: nobody → yliao
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.