You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2018/03/20 15:12:23 UTC

[2/3] lucene-solr:branch_7x: LUCENE-8106: Handle IncompleteRead exceptions while downloading the Jenkins log by retrying a limited number of times

LUCENE-8106: Handle IncompleteRead exceptions while downloading the Jenkins log by retrying a limited number of times


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/7735f2c9
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/7735f2c9
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/7735f2c9

Branch: refs/heads/branch_7x
Commit: 7735f2c911c8c3fb7cc02f9ab9c8dbe4fb70f9cd
Parents: c4a8c8d
Author: Steve Rowe <sa...@apache.org>
Authored: Tue Mar 20 11:11:33 2018 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Tue Mar 20 11:11:58 2018 -0400

----------------------------------------------------------------------
 dev-tools/scripts/reproduceJenkinsFailures.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7735f2c9/dev-tools/scripts/reproduceJenkinsFailures.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/reproduceJenkinsFailures.py b/dev-tools/scripts/reproduceJenkinsFailures.py
index 64a2732..55194a0 100644
--- a/dev-tools/scripts/reproduceJenkinsFailures.py
+++ b/dev-tools/scripts/reproduceJenkinsFailures.py
@@ -18,6 +18,7 @@ import os
 import re
 import subprocess
 import sys
+import time
 import traceback
 import urllib.error
 import urllib.request
@@ -95,7 +96,7 @@ def run(cmd, rememberFailure=True):
     lastFailureCode = code
   return code
 
-def fetchAndParseJenkinsLog(url):
+def fetchAndParseJenkinsLog(url, numRetries):
   global revisionFromLog
   global branchFromLog
   global 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()