-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
Jenkins version 2.89.4
email-ext-plugin version 2.61
Some of our tests return huge error files if the log file being parsed has matching errors that are closer together than the setting for "linesAfter". This is true even if "maxMatches" is set to just 1. Our setting in email-ext-plugin is:
${BUILD_LOG_REGEX, regex="(?m)^(nc\\w+:\\s+\\*E,|.\\bNG\\b|\\s*Error
b|E-).$", linesBefore=5, linesAfter=10, maxMatches=5, showTruncatedLines=false}
so this should limit the number of errors returned to 5. However, because the gap between matched errors is less than 10 lines this means that (in the Java code) the number of lines remaining to be written out gets reset to 10 on every subsequent match. The break condition for exiting the regex is the the number of lines remaining is 0 (amongst others) but this never happens for this case.
This can be fixed by modifying BuildLogRegexContent.java on line 291. Change this line to:
if (matched & (numMatches < maxMatches))
and this will properly limit the number of matches to the value specified in numMatches and allow the regex to complete correctly.