Closed Bug 1296560 Opened 4 years ago Closed 3 years ago

Interrupting a Sync with many outgoing records causes a shutdown crash


(Firefox :: Sync, defect, P1)






(Reporter: markh, Assigned: tcsc)



(Whiteboard: [sync-quality])

* Arrange to have many (thousands) of outgoing records for a collection.
* As soon as the collection starts Syncing, exit the app.
* Note there is now an unsubmitted crash report for the fact Firefox was crashed taking too long to shutdown.

The problem is that Sync correctly aborts due to the shutdown, but then attempts to re-add all the IDs to the tracker so we do the right thing next startup.

However, this takes so long that Firefox is terminated before shutdown. Even if it did manage to get everything added to the tracker, it's almost certainly going to fail to write the JSON file as the IO module is no longer functioning.

I can't think of an easy fix here.
No real alternative (apart from init levels!) to ordering the data and metadata operations to allow it to be interruptible. So perhaps:

- persist new tracker as changes occur. (already does?)
- download items
- apply items
- write updated tracker in the positive flow, not the cleanup handler
- fast-forward timestamp -- must occur after updating the tracker; otherwise we can mostly replay the download
- upload items
- fast-forward timestamp -- avoids us redownloading our records on interruption
- write updated tracker in the positive flow

If we're interrupted here, we will do excess work next time, but that's OK.
See Also: → 1296714
Whiteboard: [sync-quality]
Priority: -- → P3
Priority: P3 → P2
Priority: P2 → P1
Assignee: nobody → tchiovoloni
This only happens if you add 10k bookmarks in a single session, otherwise we'll still fail to write the file but we'll do so quickly and without causing a shutdown crash. Opening bug 1319175 for that and closing this as worksforme.
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.