Open Bug 1269673 Opened 10 years ago Updated 4 years ago

Better handling of retryAfter in FxAccountsClient

Categories

(Firefox :: Firefox Accounts, defect, P3)

defect

Tracking

()

People

(Reporter: markh, Unassigned)

References

Details

FxAccountsClient.jsm has relatively naive support for an error response with a retryAfter header - it auto-rejects all future requests that go through this module until the period has expired. The problem with this approach is that it's possible that not all end-points are subject to the service interruption - for example, if we find that the device management endpoint is in trouble and should be avoided, we'll end up avoiding requests that would work (such as cert signing etc). IOW, a 503 response with retryAfter from the device management endpoint will also break Sync even though it would work if we tried. Thus, the server has a disincentive to add such headers. In IRC, I suggested we could possibly maintain the back-off per request path, and rfkelly suggested that the request path seems too fine a granularity and we should maybe use a "per-feature backoff" - which makes sense, but I'm not sure how to ensure the client and server agree what a "feature" is. So this bug is to: * appropriately classify the relevant paths into "features". * arrange for the backoff to be per-feature rather than global. * optionally and with rfkelly's guidance, decide if we should also persist these backoffs so we don't immediately retry on a new browser session (Sync doesn't do this in general) A quick scan shows us hitting the following paths: /account/keys /account/status /account/device /account/devices /account/device/destroy /account/login /account/create /certificate/sign /recovery_email/status /recovery_email/resend_code /session/destroy Ryan, can offer some additional thoughts here on the grouping and/or the strategy in general? (This is somewhat relevant to bug 1268761, but probably doesn't strictly block it - it's just part of the general "don't set fire to the servers" push ;)
Flags: firefox-backlog+
ni? myself to come back to this with some thoughts
Flags: needinfo?(rfkelly)
Would it make sense for the server to drive this? Maybe we could indicate the feature in an `FxA-Feature` response header, and have the client bucket the backoffs based on that...
(In reply to Kit Cambridge [:kitcambridge] from comment #2) > Would it make sense for the server to drive this? Maybe we could indicate > the feature in an `FxA-Feature` response header, and have the client bucket > the backoffs based on that... Yeah, server driven sounds better - maybe a per-path policy but with the server telling us which paths are relevant (in the same of different header, default being just that path)?
(In reply to Mark Hammond [:markh] from comment #3) > Yeah, server driven sounds better - maybe a per-path policy but with the > server telling us which paths are relevant (in the same of different header, > default being just that path)? Nice, I like that! Let's see what rfkelly says. :-)
Yes, I like the sound of telling you which paths the response should apply to. A first version of this though, could just treat /certificate/sign as special: * A retry-after on /certificate/sign -> backoff from the whole of api.accounts.firefox.com * A retry-after on any other path -> backokff from everything but /certificate/sign Strawman for a server-driven approach: HTTP/1.1 503 Service Unavailable Retry-After: 30 Content-Type: application/json { "code": 503, "errno": 201, "retryAfter": 30, "path": "/account/" }
Flags: needinfo?(rfkelly)
Priority: -- → P1
Priority: P1 → P3
Product: Core → Firefox
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.