Closed Bug 1143526 Opened 6 years ago Closed 6 years ago

[FFOS7715 v2.1] after Power off test icons of homescreen disappear

Categories

(Firefox OS Graveyard :: Stability, defect)

ARM
Gonk (Firefox OS)
defect
Not set
critical

Tracking

(blocking-b2g:2.1S+, firefox39 wontfix, firefox40 fixed, b2g-v2.1S fixed, b2g-v2.2 fixed, b2g-v2.2r fixed, b2g-master fixed)

RESOLVED FIXED
2.2 S9 (3apr)
blocking-b2g 2.1S+
Tracking Status
firefox39 --- wontfix
firefox40 --- fixed
b2g-v2.1S --- fixed
b2g-v2.2 --- fixed
b2g-v2.2r --- fixed
b2g-master --- fixed

People

(Reporter: ben.song, Assigned: baku)

References

Details

(Whiteboard: [sprd413029])

Attachments

(4 files)

Reproduce step:

1.Do poweroff test like bug 1115619 for 4~6 days.

2.Start-up the phone normally.

Ideal result:

Icons of homescreen display completely.

Actual result:

Icons of homescreen disappear

Reproduce rate: 6/7
Severity: normal → critical
blocking-b2g: --- → 2.1S?
Whiteboard: [sprd413029]
Dear Rex, Vance,

Recently we do poweroff test again, the problem reproduced and the rate is 3/4. I have tried to modify sqlite of homescreen, the appearance is like this. Could you help me to analyse this problem, this another problem of adb daemon process died has been resolved today.

Thanks.
Flags: needinfo?(vchen)
Flags: needinfo?(rhung)
The symptom can be reproduced in power-off test with the images which include the following two patches:
1. Attachment 8554380 [details] [diff] in bug#1115619
2. Attachment 8571226 [details] [diff] in bug#1124126

After comparing the difference of homescreen DB data between this symptom and normal case, we found that:
1. The size of 1444454539veemrothilca.sqlite are different.
2. icon picture files named by number(1~15) are not found in the tested devices.
================================================================================
All icons are gone:
drwxr-x---. 3 root root  4096  3月  6 23:51 ./
drwxr-x---. 3 root root  4096  3月  6 23:51 ../
drwxr-x---. 2 root root  4096  3月  6 23:51 1444454539veemrothilca/
-rw-------. 1 root root 38912  3月  6 23:51 1444454539veemrothilca.sqlite
-rw-------. 1 root root     0  3月  6 23:51 1444454539veemrothilca.sqlite-journal

Normal case:
drwxrwxr-x 2 root root  4096  3月 13 17:47 1444454539veemrothilca
-rw-r--r-- 1 root root 45056  3月 13 17:47 1444454539veemrothilca.sqlite
-rw-r--r-- 1 root root     0  3月 13 17:47 1444454539veemrothilca.sqlite-journal
-rw-r--r-- 1 root root  6465  3月 13 17:47 1444454539veemrothilca/1
-rw-r--r-- 1 root root  6991  3月 13 17:47 1444454539veemrothilca/10
-rw-r--r-- 1 root root  5887  3月 13 17:47 1444454539veemrothilca/11
-rw-r--r-- 1 root root  5410  3月 13 17:47 1444454539veemrothilca/12
-rw-r--r-- 1 root root  7602  3月 13 17:47 1444454539veemrothilca/13
-rw-r--r-- 1 root root  7770  3月 13 17:47 1444454539veemrothilca/14
-rw-r--r-- 1 root root  6531  3月 13 17:47 1444454539veemrothilca/15
-rw-r--r-- 1 root root  6308  3月 13 17:47 1444454539veemrothilca/2
-rw-r--r-- 1 root root  6893  3月 13 17:47 1444454539veemrothilca/3
-rw-r--r-- 1 root root  7492  3月 13 17:47 1444454539veemrothilca/4
-rw-r--r-- 1 root root 30401  3月 13 17:47 1444454539veemrothilca/5
-rw-r--r-- 1 root root  9795  3月 13 17:47 1444454539veemrothilca/6
-rw-r--r-- 1 root root 41429  3月 13 17:47 1444454539veemrothilca/7
-rw-r--r-- 1 root root 41818  3月 13 17:47 1444454539veemrothilca/8
-rw-r--r-- 1 root root 41397  3月 13 17:47 1444454539veemrothilca/9
Flags: needinfo?(rhung)
Dear Rex,Danny,

Base on my analysis, i find in normal device after delete ***+f+app+++verticalhome.gaiamobile.org and restart, the sqlite of verticalhome would rebuild and icons is exist; But in problem device while delete ***+f+app+++verticalhome.gaiamobile.org and restart, the sqlite of verticalhome would alse rebuild but icons is still disappear.

So i think the origin of this problem isn't build process of verticalhome sqlite, but is the origin of sqlite reading icons, perhaps manifest of verticalhome. Do you think so ?

Thanks.
Flags: needinfo?(rhung)
Flags: needinfo?(dliang)
Hi Ben -

So the device cannot recovery even after rebooting?

Thanks
Flags: needinfo?(vchen) → needinfo?(ben.song)
(In reply to Vance Chen [:vchen][vchen@mozilla.com] from comment #4)
> Hi Ben -
> 
> So the device cannot recovery even after rebooting?
> 
> Thanks

Dear Vance,

Yes, you are right, even replacing with ***+f+app+++verticalhome.gaiamobile.org of normal device, this problem is still exist.

Thanks.
Flags: needinfo?(ben.song)
See Also: → 1115619
1066492 & 1067720 have different reproduce steps but the same symptom. Looking for the root cause.
Assignee: nobody → yliao
See Also: → 1067720, 1066492
blocking-b2g: 2.1S? → 2.1S+
Attached file 1067720_fix
Hi Ben,

Could you please try the patch and see if the issue persists? Thank you!
Flags: needinfo?(ben.song)
(In reply to yifan [:yifan][:yliao] from comment #7)
> Created attachment 8577962 [details] [review]
> 1067720_fix
> 
> Hi Ben,
> 
> Could you please try the patch and see if the issue persists? Thank you!

Dear Yifan,

OK, I would land this patch and do poweroff test to verify it.

Thanks.
Remove my NI first since Yifan is investigating this bug.
Flags: needinfo?(rhung)
Dear Yifan,

After six days poweroff test, this issue reproduced and the rate is 1/2. I would upload data module of problem device soon.

Thank.
Flags: needinfo?(ben.song) → needinfo?(yliao)
Attached file data_module.tar.gz
Dear Yifan,

This attachment is the file of data module. Please help me to analyse this problem.

Thanks.
Dear Yifan,

If as we modified, while we remove directory of ****+f+app+++verticalhome.gaiamobile.org, the database would renew one, and icons should display. But After remove it, the appearance still is no icons.

So I think the origin of this problem probably isn't ****+f+app+++verticalhome.gaiamobile.org writen incompletely.
Dear Yifan, Vance,

Base on my compare between problem device and normal device, I find the finally origin problem is in directory of /data/local/storage/persistent/chrome/idb, there is a sqlite of 444928743bpopoakbmeawr.ktss_es.sqlite, while replace with a problem 444928743bpopoakbmeawr.ktss_es.sqlite in normal device, this problem appears.

Please help me to fix this problem.

Thanks.
Flags: needinfo?(vchen)
Hi Ben,

Could you please attach both the normal and the problem sqlite file here? Thank you!
Flags: needinfo?(yliao)
Just to make sure that apart from 444928743bpopoakbmeawr.ktss_es.sqlite, is there any other sqlite file that is broken, either? This sqlite file stores user bookmarked icons to be displayed on the homescreen. I'll look into the loading part in verticalhome first.
Flags: needinfo?(ben.song)
Dear Yifan,

This attachment contains normal sqlite and problem sqlite.

Thanks.
Flags: needinfo?(ben.song) → needinfo?(yliao)
Dear Yifan,

Only 444928743bpopoakbmeawr.ktss_es.sqlite and ****+f+app+++verticalhome.gaiamobile.org are broken. And if 444928743bpopoakbmeawr.ktss_es.sqlite be OK, ****+f+app+++verticalhome.gaiamobile.org would be OK,too.

In log, I find several error like this:
03-20 21:10:59.230 E/GeckoConsole(  586): [JavaScript Error: "aEvent.target.result is undefined" {file: "resource://gre/modules/DataStoreCursorImpl.jsm" line: 173}]
03-20 21:10:59.240 E/GeckoConsole(  586): [JavaScript Error: "aEvent.target is undefined" {file: "resource://gre/modules/DataStoreCursorImpl.jsm" line: 76}]

After analysing gaia code, I get that probably there is some problem while invoking save of bookmark_source in verticalhome/js/stores/item.js, it would interrupt the read process of ****+f+app+++verticalhome.gaiamobile.org.

Thanks.
Clean my and Danny's ni since Yifan is helping on this one
Flags: needinfo?(vchen)
Flags: needinfo?(dliang)
There are 3 sources for the icons on the verticalhome: application, bookmark and collection. When booting the verticalhome, it'll load in the sequence stated above. After all 3 sources are loaded can it display the icons.

Tried booting with both normal and incorrect sqlite. When booting with the incorrect sqlite, homescreen icon loading stops at gaia: apps/verticalhome/js/sources/bookmark.js line 70, in the middle of the populate method. 

This is related to what Ben analyzed in comment 17. When the DataStore 'bookmarks_store' is corrupted, it should have issued a DOMError at https://dxr.mozilla.org/mozilla-central/source/dom/datastore/DataStoreCursorImpl.jsm#76 but failed like the log in comment 17. And in gaia the verticalhome app doesn't know this failure and thus doesn't execute the following callback to display icons.

I'll look into what cause the bookmarks_store corrupted, which should be the primary problem since verticalhome doesn't responsible for bookmarks_store creation.

----

Another issue is whether gecko will expose a error or not when DataStore API fails. I assume that we could use a try catch block for the error but in this case it seems the error isn't visible in Gaia. 

Hi Thinker, could you share some idea about this according to comment 17? Thank you!
Flags: needinfo?(yliao) → needinfo?(tlee)
Dear Thinker, Yifan,

I find CollectionSource probably would happen the same error like BookmarkSource, pls fix it, too.

Thanks.
Flags: needinfo?(tlee)
ni Thinker
Flags: needinfo?(tlee)
I don't really understand the problem here.  But, this seems like the database of datastore is not initialized completely.  So, if it is true, I would ask why it is not initialized completely, and why we don't check it and recreate it.
Flags: needinfo?(tlee)
(In reply to Thinker Li [:sinker] from comment #22)
> I don't really understand the problem here.  But, this seems like the
> database of datastore is not initialized completely.  So, if it is true, I
> would ask why it is not initialized completely, and why we don't check it
> and recreate it.

Dear Thinker,

why it is not initialized completely:

Ben: Because of progressive poweroff test, It would almost poweroff at everytime during first start-up.

why we don't check it and recreate it:

I don't know this question, but during initialition verticalhome sqlite it would invoke bookmarkdatabase, the moment bring up some problem.

Thanks.
Flags: needinfo?(tlee)
(In reply to Thinker Li [:sinker] from comment #22)
> I don't really understand the problem here.  But, this seems like the
> database of datastore is not initialized completely.  So, if it is true, I
> would ask why it is not initialized completely, and why we don't check it
> and recreate it.

Yes I'm looking into this problem. I should've described the issue which I'd like to consult you more clearly.

https://wiki.mozilla.org/WebAPI/DataStore#Sync
The Data Store API doesn't provide an example for error catching, which I assume we could use try/catch block to capture a Data Store API access error. The problem here is the error log at https://dxr.mozilla.org/mozilla-central/source/dom/datastore/DataStoreCursorImpl.jsm#76 :

03-20 21:10:59.240 E/GeckoConsole(  586): [JavaScript Error: "aEvent.target is undefined" {file: "resource://gre/modules/DataStoreCursorImpl.jsm" line: 76}]

This line supposed to dispatch a DOMError but it fails at 'aEvent.target is undefined' by itself. Should I file another bug for it?
After some digging I figured that the creation of a data store is in https://dxr.mozilla.org/mozilla-central/source/dom/datastore/DataStoreService.cpp#855 . At vertical homescreen start up the verticalhome app uses navigator.getDataStores to get the bookmarks_store, and the DataStoreService will create one if there's none. Once it's created the verticalhome app will get the data store reference, but verticalhome doesn't know if the data store is corrupted or not. Hi Vance, could you please help to find some one familiar in debugging Gecko code since this is urgent? Thank you!
Flags: needinfo?(vchen)
(In reply to yifan [:yifan][:yliao] from comment #25)
> After some digging I figured that the creation of a data store is in
> https://dxr.mozilla.org/mozilla-central/source/dom/datastore/
> DataStoreService.cpp#855 . At vertical homescreen start up the verticalhome
> app uses navigator.getDataStores to get the bookmarks_store, and the
> DataStoreService will create one if there's none. 

Hi Yifan, one quick question here : if the DataStoreService will create a new bookmarks_store for vertical homescreen to use if there is none available, how come we still have this issue? Is that because the new bookmarks_store the DataStoreService create is still corrupted?

Also ni Fabrice, hi Fabrice, as Yifan pointed out in Comment#25, we need help from core team to further check this problem, could you help to point we to the person who might move this forward?
Flags: needinfo?(vchen) → needinfo?(fabrice)
Baku owns the implementation of the datastore. It looks to me that the error at https://dxr.mozilla.org/mozilla-central/source/dom/datastore/DataStoreCursorImpl.jsm#76 should be properly fixed too.
Flags: needinfo?(fabrice) → needinfo?(amarchesini)
Thank you Vance and Fabrice. 

(In reply to Vance Chen [:vchen][vchen@mozilla.com] from comment #26)
> Hi Yifan, one quick question here : if the DataStoreService will create a
> new bookmarks_store for vertical homescreen to use if there is none
> available, how come we still have this issue? Is that because the new
> bookmarks_store the DataStoreService create is still corrupted?

I assumed that once a corrupted bookmarks_store is created, every subsequent getDataStores request will get the same corrupted one. So once it's created at start up it'll always return the corrupted data store.
Flags: needinfo?(tlee)
Attached patch dataStore patchSplinter Review
This patch fixes the DataStore error reporting issue. It turned out that newTxn calls the failure cb with a string and not with a IDB error object.
Flags: needinfo?(amarchesini)
Attachment #8585445 - Flags: review?(fabrice)
Thank you Andrea! Unassigned myself.
Assignee: yliao → nobody
Attachment #8585445 - Flags: review?(fabrice) → review+
Assignee: nobody → amarchesini
https://hg.mozilla.org/mozilla-central/rev/3851d1999bd5
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.2 S9 (3apr)
See Also: → 1152169
Dear Andrea, Yifan, Vance,

The problem reproduced in recent poweroff test, and the rate is 4/4. For the cr has closed, I have created a new cr in bug1152169.

Please help me to resolve the problem, thanks.
Flags: needinfo?(yliao)
Flags: needinfo?(vchen)
Flags: needinfo?(amarchesini)
Let's debug this bug in bug 1152169.
Flags: needinfo?(amarchesini)
Flags: needinfo?(yliao)
remove ni for vance
Flags: needinfo?(vchen)
It's unclear to me if something needs backporting here or not still. Or did bug 1152169 fix this?
status-b2g-v2.2: --- → ?
Flags: needinfo?(vchen)
Flags: needinfo?(jocheng)
Flags: needinfo?(amarchesini)
I think we need this patch and bug 1152169 landed in order to fix this issue.
Should I ask for some b2g approval?
Flags: needinfo?(amarchesini)
Bug 1152169 made it to 2.1/2.2 from the looks of it. Please request b2g37 approval on this at least. If B2G RelMan wants it on v2.1S too, the blocking status takes care of the approval side.
Comment on attachment 8585445 [details] [diff] [review]
dataStore patch

[Approval Request Comment]
Bug caused by (feature/regressing bug #): DataStore API
User impact if declined: An JS error is shown in the console and a DataStore error is not correctly propagate to the caller.
Testing completed: no test.
Risk to taking this patch (and alternatives if risky): none 
String or UUID changes made by this patch: none
Flags: needinfo?(amarchesini)
Attachment #8585445 - Flags: approval-mozilla-b2g37?
Hi Vance,
Do we still need this patch on 2.1S?
Flags: needinfo?(jocheng)
Attachment #8585445 - Flags: approval-mozilla-b2g37? → approval-mozilla-b2g37+
Yes, please land this one on 2.1s as well

Thanks
Flags: needinfo?(vchen)
You need to log in before you can comment on or make changes to this bug.