From dd6930b2699168b2b2b28b0885e7319d92f2ddd7 Mon Sep 17 00:00:00 2001 From: chipx86 Date: Thu, 28 May 2009 10:03:50 +0000 Subject: Patch by Chris Clark to set a max number of login retries, so as to prevent entering an infinite loop. This can happen when the cookie is assumed to be valid but doesn't work properly on the server. While this won't fix logins in that situation, it will prevent the infinite loop followed by a "maximum recursion deptch" error. Reviewed at http://reviews.review-board.org/r/879/ --- scripts/post-review | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/post-review b/scripts/post-review index 05eba08..e0590a8 100755 --- a/scripts/post-review +++ b/scripts/post-review @@ -2132,7 +2132,7 @@ def load_config_file(filename): def tempt_fate(server, tool, changenum, diff_content=None, - parent_diff_content=None, submit_as=None): + parent_diff_content=None, submit_as=None, retries=3): """ Attempts to create a review request on a Review Board server and upload a diff. On success, the review request path is displayed. @@ -2185,10 +2185,18 @@ def tempt_fate(server, tool, changenum, diff_content=None, except APIError, e: rsp, = e.args if rsp['err']['code'] == 103: # Not logged in - server.login(force=True) - tempt_fate(server, tool, changenum, diff_content, - parent_diff_content, submit_as) - return + retries = retries - 1 + + # We had an odd issue where the server ended up a couple of + # years in the future. Login succeeds but the cookie date was + # "odd" so use of the cookie appeared to fail and eventually + # ended up at max recursion depth :-(. Check for a maximum + # number of retries. + if retries >= 0: + server.login() + tempt_fate(server, tool, changenum, diff_content, + parent_diff_content, submit_as, retries=retries) + return if options.rid: die("Error getting review request %s: %s (code %s)" % \ -- cgit v1.2.3