slo: 500 if we can't load the manifest
When the proxy app is trying to send back an object and hits an error (maybe a timeout, maybe an EC decode error) *after* it has sent headers and started streaming data, it just stops sending data, expecting clients to notice the discrepency in Content-Length and retry. When that happened in SLO while reading a manifest, previously we'd just assume the manifest is empty and send back an empty response. This would cause confusion for users (who'd think we lost data or soemthing) and was clearly wrong. Now, return a 500 to the client. Retrying is perfectly reasonable. Change-Id: I7fc923ad0ef37459b7a76ce360dd7f320053d3f7
This commit is contained in:
parent
39127fee5b
commit
6e5b5a659a
@ -942,7 +942,7 @@ class SloGetContext(WSGIContext):
|
||||
try:
|
||||
segments = json.loads(resp_body)
|
||||
except ValueError:
|
||||
segments = []
|
||||
raise HTTPServerError('Unable to load SLO manifest')
|
||||
|
||||
return segments
|
||||
|
||||
|
@ -3303,10 +3303,14 @@ class TestSloGetManifest(SloTestCase):
|
||||
status, headers, body = self.call_slo(req)
|
||||
headers = HeaderKeyDict(headers)
|
||||
|
||||
self.assertEqual(status, '200 OK')
|
||||
self.assertEqual(headers['Content-Length'], '0')
|
||||
self.assertEqual(headers['X-Object-Meta-Fish'], 'Bass')
|
||||
self.assertEqual(body, b'')
|
||||
# This often (usually?) happens because of an incomplete read -- the
|
||||
# proxy app started getting a large manifest and sending it back to
|
||||
# SLO, then there was a timeout or something, couldn't resume in time,
|
||||
# and we've got just part of a JSON document. Having the client retry
|
||||
# seems reasonable
|
||||
self.assertEqual(status, '500 Internal Error')
|
||||
self.assertEqual(body, b'Unable to load SLO manifest')
|
||||
self.assertNotIn('X-Object-Meta-Fish', headers)
|
||||
|
||||
def _do_test_generator_closure(self, leaks):
|
||||
# Test that the SLO WSGI iterable closes its internal .app_iter when
|
||||
|
Loading…
x
Reference in New Issue
Block a user