Open Bug 1212426 Opened 9 years ago Updated 2 years ago

Use X-If-Unmodified-Since=0 to make ServerConfigurationRequiredError robust

Categories

(Firefox for iOS :: Sync, defect)

Other
iOS
defect

Tracking

()

Tracking Status
fxios + ---

People

(Reporter: nalexander, Unassigned, Mentored)

References

Details

Right now, ServerConfigurationRequiredError does two sequential PUTs to upload meta/global and crypto/keys.  We can do better: we should use X-I-U-S=0 and add a terminal ClientRaceDetected state when we see 412 status codes back.
Nick, can you mentor this, perhaps for Steph, James, or Emily?
Flags: needinfo?(nalexander)
(In reply to Richard Newman [:rnewman] from comment #1)
> Nick, can you mentor this, perhaps for Steph, James, or Emily?

Yes, absolutely.  Details on X-If-Unmodified-Since and 412 responses can be found at http://docs.services.mozilla.com/storage/apis-1.5.html#request-headers.

The code change required is including ifUnmodifiedSince: 0 to the two relevant PUTs at https://github.com/mozilla/firefox-ios/blob/c4fb24a4b4345943022db5b115811362e57f2223/Sync/SyncStateMachine.swift#L407 and just below it.  (Those two can be simultaneous, BTW.)  In success cases, advance as before.

The error case is when you see a 412.  Handle that by adding a new terminal state (say ClientRaceDetected) to the SyncStateMachine, like ClientUpgradeRequired.  (See https://people.mozilla.org/~nalexander/SyncStateMachine.pdf and https://people.mozilla.org/~nalexander/SyncStateMachine.graffle.)  The terminal state should just fail; next sync, we'll try again.

The hardest part of this will be testing, since MockSyncServer doesn't handle X-I-U-S for individual PUT requests.  And since it will probably take a custom subclass to arrange for the desired 412 Conflict response.
Mentor: nalexander
Flags: needinfo?(nalexander)
Whiteboard: nicetohave1.1
Whiteboard: nicetohave1.1
1.2?
Flags: needinfo?(rnewman)
Yes, if Nick can mentor it in the right timeframe.
Flags: needinfo?(rnewman)
Rank: 10
Does this need to go in 1.3?
Flags: needinfo?(rnewman)
(In reply to Stefan Arentz [:st3fan] from comment #5)
> Does this need to go in 1.3?

No.  Tracking+, whatever that is for iOS.
Flags: needinfo?(rnewman)
Nick, Richard, what do we need to do with this bug? It keeps popping up in triage.
Flags: needinfo?(rnewman)
Flags: needinfo?(nalexander)
(In reply to Stefan Arentz [:st3fan] from comment #7)
> Nick, Richard, what do we need to do with this bug? It keeps popping up in
> triage.

This is handling an edge of an edge race condition, and will make this client much more robust than other clients.

Feel free to de-prioritize.
Flags: needinfo?(rnewman)
Flags: needinfo?(nalexander)
Rank: 10 → 5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.