Interrupting a Sync with many outgoing records causes a shutdown crash

RESOLVED WORKSFORME

Status

()

P1
normal
RESOLVED WORKSFORME
2 years ago
2 years ago

People

(Reporter: markh, Assigned: tcsc)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [sync-quality])

(Reporter)

Description

2 years ago
STR:
* 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. 

https://dxr.mozilla.org/mozilla-central/rev/97a52326b06a07930216ebefa5af333271578904/services/sync/modules/engines.js#1559

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.
Whiteboard: [sync-quality]
Priority: -- → P3
Priority: P3 → P2
Priority: P2 → P1
(Reporter)

Updated

2 years ago
Assignee: nobody → tchiovoloni
(Assignee)

Comment 2

2 years ago
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.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.