Closed Bug 1066492 Opened 10 years ago Closed 9 years ago

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

Categories

(Firefox OS Graveyard :: Gaia::Homescreen, defect)

ARM
Gonk (Firefox OS)
defect
Not set
blocker

Tracking

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

RESOLVED WONTFIX
blocking-b2g -
Tracking Status
b2g-v1.4 --- affected

People

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

References

Details

Attachments

(2 files, 2 obsolete files)

Immediately interruption of power supply before choosing language in ftu when reset phone,buttons in dockbar and collection is disappear,the background is exist.
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.
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
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.
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
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
Attached patch homescreen.patch (obsolete) — Splinter Review
Attachment #8488539 - Flags: review?(james.zhang)
[Blocking Requested - why for this release]:
blocking-b2g: --- → 1.4?
QA Whiteboard: qawanted
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)
(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.
See Also: → 1067720
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)
(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)
It is persistent so the value you saved will be retained for the homescreen app.
(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.
Attached patch new.patch (obsolete) — Splinter Review
Hi Yi-Fan,

   I have updated this patch with what you said.Please review it.Thanks.
Attachment #8489819 - Flags: review?(yliao)
Flags: needinfo?(yliao)
Attached file 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)
Dear Rachelle,
Plz help to push this patch review ,Thanks.
Flags: needinfo?(wchang)
Flags: needinfo?(ryang)
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)
(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.
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)
(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
Attached patch update.patchSplinter Review
Hi Cristian,

   This is the updated patch,can you help me to review it? Thanks.
Attachment #8490499 - Flags: review?(crdlc)
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+
Thank you! Sorry for the mistake, fixed in the PR.
Patch ready,clear ni.
Flags: needinfo?(ryang)
Flags: needinfo?(kevin)
See Also: → 1143526
Assignee: nobody → yliao
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: