Closed Bug 471192 Opened 16 years ago Closed 15 years ago

HTTP error codes are not recognized properly

Categories

(Firefox :: Sync, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: kronos.it, Assigned: mconnor)

References

Details

(Whiteboard: [should be fixed by bug 497938])

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.0.3) Gecko/2008092816 Iceweasel/3.0.4 (Debian-3.0.4-1)
Build Identifier: hg 1271:e1c4b9fcbe27

Resource class checks a few HTTP status codes to determine whether the request was successful or not.
HTTP 5xx error codes (see RFC2616) are all server-side errors, but weave - with the exception of 501 (not implemented) and 505 (HTTP version not supported) - consider them as "success"; this is bad since the server component uses 503 (service unavailable) to signal error conditions (mostly database outages).

Reproducible: Always

Steps to Reproduce:
1. Stop the DB backend of the server component to simulate the error condition
2. Try and login
Actual Results:  
From weave log:

Net.Resource	DEBUG	GET request for http://127.0.0.1/~kronos/0.3/user/kronos
Net.Resource	DEBUG	GET request successful (503)


Expected Results:  
From weave log, with proposed patch applied:

Net.Resource	DEBUG	GET request for http://127.0.0.1/~kronos/0.3/user/kronos
Net.Resource	DEBUG	GET request failed (503)
Net.Resource	DEBUG	Error response: 
"Database unavailable"
Indeed, we don't handle 503s correctly.  Weave should check for a Retry-After header and retry after that time, otherwise treat a 503 as a 500 (per the spec).  But 500 itself is not handled correctly either.

The reason we handle 501 and 505 correctly but not the rest is that those are the ones in the spec that are 100% guaranteed to be permanent errors (retrying will not help) -- at least when I took a quick glance at the spec at the time.
Blocks: 468694
Status: UNCONFIRMED → NEW
Ever confirmed: true
Target Milestone: -- → 0.3
Attachment #354495 - Flags: review?(thunder)
AFAIK Retry-After is optional and in my experience very uncommon, so I'm not sure it's worth adding a special case for 503.
Anyway I'd put the retry logic at an higher level, since the desired behaviour is context-specific: during scheduled sync the best option is probably "don't care, retry at the next scheduled sync", while at login time it may make sense to retry a few times.
503 + Retry-After is uncommon in the wild, but it's a good way for the server to tell clients to back off when it's under heavy load.  We have our own server, so we might use that (we expect Weave servers to be under high load).

You may be right anyway and we could just fail and let the next sync take care of it. Hmm.
Punting to 0.4, we need to look at this code again and figure out where things stand.
Target Milestone: 0.3 → 0.4
No longer blocks: 468694
Target Milestone: 0.4 → 0.5
Target Milestone: 0.5 → 1.0
Component: Weave → General
Product: Mozilla Labs → Weave
QA Contact: weave → general
We should get a plan on this sooner or later, including the bug on supporting backoff properly.
Target Milestone: 1.0 → 0.5
Attachment #354495 - Flags: review?(thunder)
Comment on attachment 354495 [details] [diff] [review]
Add all 5xx HTTP error codes to the "failure" list.

Pretty sure this isn't the right fix, from discussion in triage.
Assignee: nobody → mconnor
Component: General → Sync
Depends on: 497938
QA Contact: general → sync
Whiteboard: [should be fixed by bug 497938]
Fixed by bug 497938
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Component: Firefox Sync: Backend → Sync
Product: Cloud Services → Firefox
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: