Apache Lucene open-source search software
LUCENE-8106: Handle IncompleteRead exceptions while downloading the Jenkins log by retrying a limited number of times
Steve Rowe0c61c857c89b
diff --git a/dev-tools/scripts/reproduceJenkinsFailures.py b/dev-tools/scripts/reproduceJenkinsFailures.pyindex 64a273247b2..55194a0914f 100644--- a/dev-tools/scripts/reproduceJenkinsFailures.py+++ b/dev-tools/scripts/reproduceJenkinsFailures.py@@ -18,6 +18,7 @@ import osimport reimport subprocessimport sys+import timeimport tracebackimport urllib.errorimport urllib.request@@ -95,7 +96,7 @@ def run(cmd, rememberFailure=True):lastFailureCode = codereturn code-def fetchAndParseJenkinsLog(url):+def fetchAndParseJenkinsLog(url, numRetries):global revisionFromLogglobal branchFromLogglobal antOptions@@ -127,11 +128,19 @@ def fetchAndParseJenkinsLog(url):print('[repro] Ant options: %s' % antOptions)except urllib.error.URLError as e:raise RuntimeError('ERROR: fetching %s : %s' % (url, e))-+ except http.client.IncompleteRead as e:+ if numRetries > 0:+ print('[repro] Encountered IncompleteRead exception, pausing and then retrying...')+ time.sleep(2) # pause for 2 seconds+ return fetchAndParseJenkinsLog(url, numRetries - 1)+ else:+ print('[repro] Encountered IncompleteRead exception, aborting after too many retries.')+ raise RuntimeError('ERROR: fetching %s : %s' % (url, e))+if revisionFromLog == None:if reJenkinsURLWithoutConsoleText.match(url):print('[repro] Not a Jenkins log. Appending "/consoleText" and retrying ...\n')- fetchAndParseJenkinsLog(url + '/consoleText')+ return fetchAndParseJenkinsLog(url + '/consoleText', numRetries)else:raise RuntimeError('ERROR: %s does not appear to be a Jenkins log.' % url)if 0 == len(tests):@@ -223,7 +232,7 @@ def getLocalGitBranch():def main():config = readConfig()- tests = fetchAndParseJenkinsLog(config.url)+ tests = fetchAndParseJenkinsLog(config.url, numRetries = 2)if config.useGit:localGitBranch = getLocalGitBranch()