Closed Bug 1352947 Opened 7 years ago Closed 5 years ago

Android writes many root folders with children missing or in the wrong order

Categories

(Firefox for Android Graveyard :: Android Sync, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED INACTIVE

People

(Reporter: markh, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [data-integrity][sync:bookmarks][Sync Q3 OKR])

This may be a dupe of one of our "bookmarks are reordered" bugs, but I couldn't see a good Android one to use.

STR:
* On desktop, create some bookmarks in your toolbar, then create a new fxa account and sync, exit desktop.
* On a clean install of fennec, sign in to the FxA account, then Sync.
* Create a bookmark, sync, close Fennec.
* Restart desktop, sync.

Fennec writes new records for "menu" and "toolbar", but they are missing a number of children. From desktop's logs:

As the items are outgoing during the first sync:

> Outgoing: { id: menu ... payload: {"id":"menu","type":"folder","parentid":"places","parentName":"","dateAdded":1490946537347,"title":"Bookmarks Menu","children":["Pwds3-Av11Sy","0NwjhZzToOqX","Oj62kg9uVBqG"]}  collection: bookmarks }
> Outgoing: { id: toolbar ... payload: {"id":"toolbar","type":"folder","parentid":"places","parentName":"","dateAdded":1490946537347,"title":"Bookmarks Toolbar","description":"Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar","children":["q6ld2aX78ngx","2MExqtZcayci","PEyrIkjokRjH","pHnBcpSQp8h-","YRuLO6WeN-zs","92zgiVXybXUX"]}  collection: bookmarks }

After restarting desktop we see the following logs:

> Incoming: { id: menu  index: 1000000  modified: 1491201441.7  ttl: undefined  payload: {"id":"menu","children":["Oj62kg9uVBqG"],"parentid":"places","title":"Bookmarks Menu","type":"folder","parentName":""}  collection: bookmarks }

When we wrote "menu" it had 4 children - it now has 1.

> Incoming: { id: toolbar  index: 1000000  modified: 1491201441.7  ttl: undefined  payload: {"id":"toolbar","children":["PEyrIkjokRjH","pHnBcpSQp8h-","92zgiVXybXUX"],"parentid":"places","title":"Bookmarks Toolbar","type":"folder","parentName":""}  collection: bookmarks }

When we wrote "toolbar" it had 6 children - it now has 3. Missing are:
* q6ld2aX78ngx - default desktop bookmark, type=query, uri=place:sort=8&maxResults=10
* 2MExqtZcayci - default desktop bookmark, type=bookmark, uri=https://www.mozilla.org/en-US/contribute/
* YRuLO6WeN-zs - livemark I created for testing, type=livemark

It's odd that the type="bookmark" is missing - I was expecting something like "all types not supported by Fennec are missing", but apparently it's not that simple. When desktop applies the record, it may reorder the missing items. As expected, the desktop validator makes lots of noise about this.

The 2 problems here are:
* Fennec uploads "menu" and "toolbar" even though it didn't change them.
* The records it uploaded are missing children.
I suspect the types are a red herring — Android stores all valid types, so if anything it's the types we might need to merge (folders and bookmarks) that are more vulnerable!
Triage: Grisha will take a look.
Assignee: nobody → gkruglov
Priority: -- → P1
See Also: → 1352549
See Also: → 769476
See Also: → 1346792
Using Kit's script at https://gist.github.com/kitcambridge/ae61d4e8ce54db74d18379c5d8393258 to generate the initial set of bookmarks demonstrates that in many cases the order of children which are included are wrong, causing desktop to (correctly) use that order.
Summary: Android writes many root folders with children missing → Android writes many root folders with children missing or in the wrong order
Blocks: 1353641
(In reply to Richard Newman [:rnewman] from comment #1)
> I suspect the types are a red herring — Android stores all valid types, so
> if anything it's the types we might need to merge (folders and bookmarks)
> that are more vulnerable!

Even though we have a comment stating the opposite ([0]), fennec does supposedly store folders, bookmarks, separators, livemarks and queries. See [1].

I'll trace through this to see what's going wrong.

[0] https://dxr.mozilla.org/mozilla-central/source/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/android/AndroidBrowserRepositorySession.java#409-420
[1] https://dxr.mozilla.org/mozilla-central/source/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/android/BrowserContractHelpers.java#121
Assignee: gkruglov → nobody
Priority: P1 → P2
Whiteboard: [data-integrity][sync:bookmarks] → [data-integrity][sync:bookmarks][Sync Q3 OKR]
Product: Android Background Services → Firefox for Android
P1 (data corruption that effects all clients). Possible dupe of bug 1419071.
Priority: P2 → P1
Moving to p3 because no activity for at least 24 weeks.
See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage for more information
Priority: P1 → P3

Wasn't able to reproduce this on latest Nightly build (desktop and mobile) following the steps from the description.
Environment: Win10 x64, Android 6.0.1. This is still reproducible?

Yep, it's still an issue, but I don't think we'll be investing further in Fennec's Sync implementation. INACTIVE seems like the right resolution.

Status: NEW → RESOLVED
Closed: 5 years ago
Keywords: stalled
Resolution: --- → INACTIVE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.