Uploaded image for project: 'Chukwa'
  1. Chukwa
  2. CHUKWA-641

PatternSyntaxException Crash from Unvalidated Regular Expression Usage

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.5.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Chukwa sometimes crashes with an unhelpful stack trace. In particular, a PatternSyntaxException is thrown when an invalid regular expression is passed to the dumpChunk command. This exception isn't useful to users to diagnose the error. I think it would be better to report a detailed error message. The attached patch makes this change.

      Steps to reproduce:

      1. Run 'bin/chukwa dumpChunk "tags.=(" file'
      2. dumpChunk command fails to start
      3. See exception:
      Exception in thread "main" java.util.regex.PatternSyntaxException:
      Unclosed group near index 1
      (
       ^
             at java.util.regex.Pattern.error(Pattern.java:1713)
             at java.util.regex.Pattern.accept(Pattern.java:1571)
             at java.util.regex.Pattern.group0(Pattern.java:2533)
             at java.util.regex.Pattern.sequence(Pattern.java:1806)
             at java.util.regex.Pattern.expr(Pattern.java:1752)
             at java.util.regex.Pattern.compile(Pattern.java:1460)
             at java.util.regex.Pattern.<init>(Pattern.java:1133)
             at java.util.regex.Pattern.compile(Pattern.java:847)
             at org.apache.hadoop.chukwa.util.Filter.<init>(Filter.java:94)
             at org.apache.hadoop.chukwa.util.DumpChunks.dump(DumpChunks.java:88)
             at org.apache.hadoop.chukwa.util.DumpChunks.main(DumpChunks.java:53)
      

      After applying the supplied patch the output is:

      Error parsing "tags" regular expression: Unclosed group near index 1
      (
       ^
      
      1. CHUKWA-641.patch
        0.9 kB
        Eric Spishak

        Activity

        Hide
        eyang Eric Yang added a comment -

        Exception message is printed to stdout. Should it be stderr?

        Show
        eyang Eric Yang added a comment - Exception message is printed to stdout. Should it be stderr?
        Hide
        espishak Eric Spishak added a comment -

        I've updated the patch to print to stderr.

        Show
        espishak Eric Spishak added a comment - I've updated the patch to print to stderr.
        Hide
        eyang Eric Yang added a comment -

        +1 Thanks Eric, I just committed this.

        Show
        eyang Eric Yang added a comment - +1 Thanks Eric, I just committed this.
        Hide
        hudson Hudson added a comment -

        Integrated in Chukwa-trunk #444 (See https://builds.apache.org/job/Chukwa-trunk/444/)
        CHUKWA-641. Fix stack trace for dumpChunk command when invalid regular expression is specified. (Eric Spishak via Eric Yang) (Revision 1336479)

        Result = SUCCESS
        eyang : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1336479
        Files :

        • /incubator/chukwa/trunk/CHANGES.txt
        • /incubator/chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/util/DumpChunks.java
        Show
        hudson Hudson added a comment - Integrated in Chukwa-trunk #444 (See https://builds.apache.org/job/Chukwa-trunk/444/ ) CHUKWA-641 . Fix stack trace for dumpChunk command when invalid regular expression is specified. (Eric Spishak via Eric Yang) (Revision 1336479) Result = SUCCESS eyang : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1336479 Files : /incubator/chukwa/trunk/CHANGES.txt /incubator/chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/util/DumpChunks.java

          People

          • Assignee:
            espishak Eric Spishak
            Reporter:
            espishak Eric Spishak
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development