On 6/17/2012 at 11:42 AM, Uwe Schindler wrote:
> We had a failed build last night, but no eMail was sent! So I looked into
> the server's log, and found the following - something in your regex seems
> to cause a stack overflow (this is not shown in the build log itself, only
> the server log). The same may happen on Apache's Jenkins, but I have no
> access to build logs there.

Hmm, it appears to be affecting Apache's Jenkins too - no email was sent for 
these failed builds: <https://builds.apache.org/job/Solr-4.x/12/> and 
<https://builds.apache.org/job/Solr-trunk/1887/>.

> Jun 17, 2012 9:35:29 AM hudson.plugins.girls.CordellWalkerRecorder <init>
> INFO: Girls are activated
> Jun 17, 2012 9:34:29 AM hudson.model.Executor run
> SEVERE: Executor threw an exception
> java.lang.StackOverflowError
>       at java.util.regex.Pattern$BranchConn.match(Pattern.java:4078)
>       at java.util.regex.Pattern$CharProperty.match(Pattern.java:3345)
>       at java.util.regex.Pattern$Branch.match(Pattern.java:4114)
>       at java.util.regex.Pattern$GroupHead.match(Pattern.java:4168)
>       at java.util.regex.Pattern$Loop.match(Pattern.java:4295)
>       at java.util.regex.Pattern$GroupTail.match(Pattern.java:4227)
>       at java.util.regex.Pattern$BranchConn.match(Pattern.java:4078)
>       at java.util.regex.Pattern$CharProperty.match(Pattern.java:3345)
>       at java.util.regex.Pattern$Branch.match(Pattern.java:4114)
>       at java.util.regex.Pattern$GroupHead.match(Pattern.java:4168)
>       at java.util.regex.Pattern$Loop.match(Pattern.java:4295)
[...]

I downloaded the logs for the two failed jobs 
(Lucene-Solr-trunk-Linux-Java7-64/307 & .../309), and ran the below-listed 
program against them on Win7 using both Oracle JDK 1.6.0_21 and 1.7.0_01 with 
default settings.  No stack overflow, and it finds and prints out the expected 
stuff.  (I include the line-counting thing because that's also used by the 
Jenkins plugin, just in case that might be the problem.)  

FYI, the source for the BUILD_LOG_MULTILINE_REGEX functionality is here: 
<https://github.com/jenkinsci/email-ext-plugin/blob/master/src/main/java/hudson/plugins/emailext/plugins/content/BuildLogMultilineRegexContent.java>;
 test suite here: 
<https://github.com/jenkinsci/email-ext-plugin/blob/master/src/test/java/hudson/plugins/emailext/plugins/content/BuildLogMultilineRegexContentTest.java>.

Uwe, do you have any idea how to diagnose what's happening?

Steve

-----------------------
import java.io.File;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

public class Test {
    static final Pattern pattern = Pattern.compile("(?x:"
      +"# Compilation failures\n"
      +"(?:.*\\[javac\\].*\\r?\\n)*.*\\[javac\\]\\s+[1-9]\\d*\\s+error.*\\r?\\n 
                                           \n"
      +"# Test failures                                                         
                                           \n"
      
+"|.*\\[junit4\\]\\s*Suite:.*[\\r\\n]+.*\\[junit4\\]\\s*(?!Completed)(?!IGNOR)\\S(?s:.*?)<<<\\s*FAILURES!
            \n"
      +"# Source file license problems                                          
                                           \n"
      
+"|.*rat-sources:.*(?:\\r?\\n.*\\[echo\\].*)*\\s+[1-9]\\d*\\s+Unknown\\s+Licenses.*\\r?\\n(?:.*\\[echo\\].*\\r?\\n)*
 \n"
      +"# Third-party dependency license problems - include 2 preceding lines 
and 1 following line                         \n"
      +"|(?:.*\\r?\\n){2}.*\\[licenses\\]\\s+MISSING\\s+sha1(?:.*\\r?\\n){2}    
                                           \n"
      +"# Javadoc warnings                                                      
                                           \n"
      
+"|(?:.*\\[javadoc\\].*\\r?\\n)*.*\\[javadoc\\]\\s*[1-9]\\d*\\s+warnings.*\\r?\\n
                                    \n"
      +"# Other javadocs problems: broken links and missing javadocs            
                                           \n"
      +"|.*javadocs-lint:.*\\r?\\n(?:.*\\[echo\\].*\\r?\\n)*                    
                                           \n"
      +"# Thread dumps - include 1 preceding line and the remainder of the log  
                                           \n"
      +"|.*\\r?\\n.*Full\\s+thread\\s+dump(?s:.*)                               
                                           \n"
      +"# Jenkins problems - include the remainder of the log                   
                                           \n"
      +"|.*(?:FATAL|ERROR):(?s:.*)                                              
                                           \n"
      +"# Include the Ant call stack - include the remainder of the log         
                                           \n"
      +"|.*BUILD\\s+FAILED(?s:.*)                                               
                                           \n"
      +")");
    static final Pattern lineCountPattern = Pattern.compile("(?<=.)\r?\n");
    
    public static void main(String[] args) throws IOException {
        StringBuilder builder = new StringBuilder();
        File file = new File(args[0]);
        BufferedReader reader = new BufferedReader(new FileReader(file));
        String line;
        while (null != (line = reader.readLine())) {
            builder.append(line).append("\n");
        }
        Matcher matcher = pattern.matcher(builder);
        while (matcher.find()) {
            System.err.println("Found: '" + matcher.group() + "'");
        }
        matcher = lineCountPattern.matcher(builder);
        int lineCount = 0;
        while (matcher.find()) {
            ++lineCount;
        }
        System.err.println("# lines: " + lineCount);
    }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to