From ff6b359d066981861f35fbc31803321a6e6b3304 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Wed, 15 Feb 2023 21:00:51 -0800 Subject: [PATCH] Retry with fresh socket on 499 Change-Id: I0c22eefb587375997672724c03744c9cda473708 --- swiftclient/client.py | 4 +++- test/unit/test_swiftclient.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/swiftclient/client.py b/swiftclient/client.py index e42ac700..b9f12aac 100644 --- a/swiftclient/client.py +++ b/swiftclient/client.py @@ -1821,7 +1821,9 @@ class Connection: retried_auth = True elif self.attempts > self.retries or err.http_status is None: raise - elif err.http_status == 408: + elif err.http_status in (408, 499): + # Server hit a timeout, so HTTP request/response framing + # are likely in a bad state; trash the connection self.http_conn = None elif 500 <= err.http_status <= 599: pass diff --git a/test/unit/test_swiftclient.py b/test/unit/test_swiftclient.py index ae3e76fd..55b4679a 100644 --- a/test/unit/test_swiftclient.py +++ b/test/unit/test_swiftclient.py @@ -2224,6 +2224,7 @@ class TestConnection(MockHttpTest): do_test(401, 2) # others will be tried until retry limits do_test(408, 6) + do_test(499, 6) do_test(500, 6) do_test(503, 6)