Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-12324

Better exception reporting in SaslPlainServer

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.0
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: security
    • Labels:
      None
    • Target Version/s:

      Description

      This is a follow up from HADOOP-12318. The review comment from Steve Loughran:

      -1. It's critical to use Exception.toString() and not .getMessage(), as some exceptions (NPE) don't have messages.

      This is the promised follow-up Jira.

      CC: Aaron T. Myers

        Issue Links

          Activity

          Hide
          hadoopqa Hadoop QA added a comment -



          -1 overall



          Vote Subsystem Runtime Comment
          0 pre-patch 17m 2s Pre-patch trunk compilation is healthy.
          +1 @author 0m 0s The patch does not contain any @author tags.
          -1 tests included 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
          +1 javac 7m 43s There were no new javac warning messages.
          +1 javadoc 9m 47s There were no new javadoc warning messages.
          +1 release audit 0m 24s The applied patch does not increase the total number of release audit warnings.
          +1 checkstyle 1m 17s There were no new checkstyle issues.
          +1 whitespace 0m 0s The patch has no lines that end in whitespace.
          +1 install 1m 21s mvn install still works.
          +1 eclipse:eclipse 0m 32s The patch built with eclipse:eclipse.
          +1 findbugs 1m 50s The patch does not introduce any new Findbugs (version 3.0.0) warnings.
          -1 common tests 22m 35s Tests failed in hadoop-common.
              62m 35s  



          Reason Tests
          Failed unit tests hadoop.net.TestNetUtils
            hadoop.ipc.TestSaslRPC
            hadoop.ha.TestZKFailoverController



          Subsystem Report/Notes
          Patch URL http://issues.apache.org/jira/secure/attachment/12750624/HADOOP-12324.000.patch
          Optional Tests javadoc javac unit findbugs checkstyle
          git revision trunk / dc7a061
          hadoop-common test log https://builds.apache.org/job/PreCommit-HADOOP-Build/7481/artifact/patchprocess/testrun_hadoop-common.txt
          Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/7481/testReport/
          Java 1.7.0_55
          uname Linux asf900.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
          Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/7481/console

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 pre-patch 17m 2s Pre-patch trunk compilation is healthy. +1 @author 0m 0s The patch does not contain any @author tags. -1 tests included 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javac 7m 43s There were no new javac warning messages. +1 javadoc 9m 47s There were no new javadoc warning messages. +1 release audit 0m 24s The applied patch does not increase the total number of release audit warnings. +1 checkstyle 1m 17s There were no new checkstyle issues. +1 whitespace 0m 0s The patch has no lines that end in whitespace. +1 install 1m 21s mvn install still works. +1 eclipse:eclipse 0m 32s The patch built with eclipse:eclipse. +1 findbugs 1m 50s The patch does not introduce any new Findbugs (version 3.0.0) warnings. -1 common tests 22m 35s Tests failed in hadoop-common.     62m 35s   Reason Tests Failed unit tests hadoop.net.TestNetUtils   hadoop.ipc.TestSaslRPC   hadoop.ha.TestZKFailoverController Subsystem Report/Notes Patch URL http://issues.apache.org/jira/secure/attachment/12750624/HADOOP-12324.000.patch Optional Tests javadoc javac unit findbugs checkstyle git revision trunk / dc7a061 hadoop-common test log https://builds.apache.org/job/PreCommit-HADOOP-Build/7481/artifact/patchprocess/testrun_hadoop-common.txt Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/7481/testReport/ Java 1.7.0_55 uname Linux asf900.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/7481/console This message was automatically generated.
          Hide
          busbey Sean Busbey added a comment -

          test failures are related.

          Show
          busbey Sean Busbey added a comment - test failures are related.
          Hide
          busbey Sean Busbey added a comment -

          example of related failed test:

          Tests run: 85, Failures: 5, Errors: 0, Skipped: 0, Time elapsed: 27.003 sec <<< FAILURE! - in org.apache.hadoop.ipc.TestSaslRPC
          testSaslPlainServerBadPassword[0](org.apache.hadoop.ipc.TestSaslRPC)  Time elapsed: 0.029 sec  <<< FAILURE!
          org.junit.ComparisonFailure: expected:<PLAIN auth failed: []wrong password> but was:<PLAIN auth failed: [java.lang.IllegalArgumentException: ]wrong password>
          	at org.junit.Assert.assertEquals(Assert.java:115)
          	at org.junit.Assert.assertEquals(Assert.java:144)
          	at org.apache.hadoop.ipc.TestSaslRPC.testSaslPlainServerBadPassword(TestSaslRPC.java:561)
          
          testSaslPlainServerBadPassword[1](org.apache.hadoop.ipc.TestSaslRPC)  Time elapsed: 0.011 sec  <<< FAILURE!
          org.junit.ComparisonFailure: expected:<PLAIN auth failed: []wrong password> but was:<PLAIN auth failed: [java.lang.IllegalArgumentException: ]wrong password>
          	at org.junit.Assert.assertEquals(Assert.java:115)
          	at org.junit.Assert.assertEquals(Assert.java:144)
          	at org.apache.hadoop.ipc.TestSaslRPC.testSaslPlainServerBadPassword(TestSaslRPC.java:561)
          
          testSaslPlainServerBadPassword[2](org.apache.hadoop.ipc.TestSaslRPC)  Time elapsed: 0.005 sec  <<< FAILURE!
          org.junit.ComparisonFailure: expected:<PLAIN auth failed: []wrong password> but was:<PLAIN auth failed: [java.lang.IllegalArgumentException: ]wrong password>
          	at org.junit.Assert.assertEquals(Assert.java:115)
          	at org.junit.Assert.assertEquals(Assert.java:144)
          	at org.apache.hadoop.ipc.TestSaslRPC.testSaslPlainServerBadPassword(TestSaslRPC.java:561)
          
          testSaslPlainServerBadPassword[3](org.apache.hadoop.ipc.TestSaslRPC)  Time elapsed: 0.007 sec  <<< FAILURE!
          org.junit.ComparisonFailure: expected:<PLAIN auth failed: []wrong password> but was:<PLAIN auth failed: [java.lang.IllegalArgumentException: ]wrong password>
          	at org.junit.Assert.assertEquals(Assert.java:115)
          	at org.junit.Assert.assertEquals(Assert.java:144)
          	at org.apache.hadoop.ipc.TestSaslRPC.testSaslPlainServerBadPassword(TestSaslRPC.java:561)
          
          testSaslPlainServerBadPassword[4](org.apache.hadoop.ipc.TestSaslRPC)  Time elapsed: 0.006 sec  <<< FAILURE!
          org.junit.ComparisonFailure: expected:<PLAIN auth failed: []wrong password> but was:<PLAIN auth failed: [java.lang.IllegalArgumentException: ]wrong password>
          	at org.junit.Assert.assertEquals(Assert.java:115)
          	at org.junit.Assert.assertEquals(Assert.java:144)
          	at org.apache.hadoop.ipc.TestSaslRPC.testSaslPlainServerBadPassword(TestSaslRPC.java:561)
          
          
          Show
          busbey Sean Busbey added a comment - example of related failed test: Tests run: 85, Failures: 5, Errors: 0, Skipped: 0, Time elapsed: 27.003 sec <<< FAILURE! - in org.apache.hadoop.ipc.TestSaslRPC testSaslPlainServerBadPassword[0](org.apache.hadoop.ipc.TestSaslRPC) Time elapsed: 0.029 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<PLAIN auth failed: []wrong password> but was:<PLAIN auth failed: [java.lang.IllegalArgumentException: ]wrong password> at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at org.apache.hadoop.ipc.TestSaslRPC.testSaslPlainServerBadPassword(TestSaslRPC.java:561) testSaslPlainServerBadPassword[1](org.apache.hadoop.ipc.TestSaslRPC) Time elapsed: 0.011 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<PLAIN auth failed: []wrong password> but was:<PLAIN auth failed: [java.lang.IllegalArgumentException: ]wrong password> at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at org.apache.hadoop.ipc.TestSaslRPC.testSaslPlainServerBadPassword(TestSaslRPC.java:561) testSaslPlainServerBadPassword[2](org.apache.hadoop.ipc.TestSaslRPC) Time elapsed: 0.005 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<PLAIN auth failed: []wrong password> but was:<PLAIN auth failed: [java.lang.IllegalArgumentException: ]wrong password> at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at org.apache.hadoop.ipc.TestSaslRPC.testSaslPlainServerBadPassword(TestSaslRPC.java:561) testSaslPlainServerBadPassword[3](org.apache.hadoop.ipc.TestSaslRPC) Time elapsed: 0.007 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<PLAIN auth failed: []wrong password> but was:<PLAIN auth failed: [java.lang.IllegalArgumentException: ]wrong password> at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at org.apache.hadoop.ipc.TestSaslRPC.testSaslPlainServerBadPassword(TestSaslRPC.java:561) testSaslPlainServerBadPassword[4](org.apache.hadoop.ipc.TestSaslRPC) Time elapsed: 0.006 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<PLAIN auth failed: []wrong password> but was:<PLAIN auth failed: [java.lang.IllegalArgumentException: ]wrong password> at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at org.apache.hadoop.ipc.TestSaslRPC.testSaslPlainServerBadPassword(TestSaslRPC.java:561)
          Hide
          busbey Sean Busbey added a comment -

          total side effects of this change, AFAICT:

          • Addition of class name for underlying cause in all cases
          • localized message is used instead of the raw message

          The example failures above are from the first change. I'd be very surprised if we have any tests that cover the second one.

          Show
          busbey Sean Busbey added a comment - total side effects of this change, AFAICT: Addition of class name for underlying cause in all cases localized message is used instead of the raw message The example failures above are from the first change. I'd be very surprised if we have any tests that cover the second one.
          Hide
          stevel@apache.org Steve Loughran added a comment -

          That's bad practise in those tests: we add better reporting & they break. Tests should, ideally

          1. use .contains() instead of .startsWith()
          2. use constant strings for error text in the source files, strings referenced in the test cases.

          here we should change those failing tests to use the contains() probe. Or, do we want to be clever and so something complex like

          e.getMessage()!=null? e.getMessage(): e.toString()
          
          Show
          stevel@apache.org Steve Loughran added a comment - That's bad practise in those tests: we add better reporting & they break. Tests should, ideally use .contains() instead of .startsWith() use constant strings for error text in the source files, strings referenced in the test cases. here we should change those failing tests to use the contains() probe. Or, do we want to be clever and so something complex like e.getMessage()!= null ? e.getMessage(): e.toString()
          Hide
          busbey Sean Busbey added a comment -

          In my experience, consistent log message formats are better than clever ones.

          OTOH, we'll be changing the way log messages show up for access failures. Presumably we can just release note that?

          Show
          busbey Sean Busbey added a comment - In my experience, consistent log message formats are better than clever ones. OTOH, we'll be changing the way log messages show up for access failures. Presumably we can just release note that?
          Hide
          stevel@apache.org Steve Loughran added a comment -

          +1, committed!

          Show
          stevel@apache.org Steve Loughran added a comment - +1, committed!
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-trunk-Commit #8434 (See https://builds.apache.org/job/Hadoop-trunk-Commit/8434/)
          HADOOP-12324. Better exception reporting in SaslPlainServer. (Mike Yoder via stevel) (stevel: rev ca0827a86235dbc4d7e00cc8426ebff9fcc2d421)

          • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslPlainServer.java
          • hadoop-common-project/hadoop-common/CHANGES.txt
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-trunk-Commit #8434 (See https://builds.apache.org/job/Hadoop-trunk-Commit/8434/ ) HADOOP-12324 . Better exception reporting in SaslPlainServer. (Mike Yoder via stevel) (stevel: rev ca0827a86235dbc4d7e00cc8426ebff9fcc2d421) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslPlainServer.java hadoop-common-project/hadoop-common/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #372 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/372/)
          HADOOP-12324. Better exception reporting in SaslPlainServer. (Mike Yoder via stevel) (stevel: rev ca0827a86235dbc4d7e00cc8426ebff9fcc2d421)

          • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslPlainServer.java
          • hadoop-common-project/hadoop-common/CHANGES.txt
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #372 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/372/ ) HADOOP-12324 . Better exception reporting in SaslPlainServer. (Mike Yoder via stevel) (stevel: rev ca0827a86235dbc4d7e00cc8426ebff9fcc2d421) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslPlainServer.java hadoop-common-project/hadoop-common/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Hadoop-Yarn-trunk-Java8 #378 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/378/)
          HADOOP-12324. Better exception reporting in SaslPlainServer. (Mike Yoder via stevel) (stevel: rev ca0827a86235dbc4d7e00cc8426ebff9fcc2d421)

          • hadoop-common-project/hadoop-common/CHANGES.txt
          • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslPlainServer.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Hadoop-Yarn-trunk-Java8 #378 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/378/ ) HADOOP-12324 . Better exception reporting in SaslPlainServer. (Mike Yoder via stevel) (stevel: rev ca0827a86235dbc4d7e00cc8426ebff9fcc2d421) hadoop-common-project/hadoop-common/CHANGES.txt hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslPlainServer.java
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Yarn-trunk #1110 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/1110/)
          HADOOP-12324. Better exception reporting in SaslPlainServer. (Mike Yoder via stevel) (stevel: rev ca0827a86235dbc4d7e00cc8426ebff9fcc2d421)

          • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslPlainServer.java
          • hadoop-common-project/hadoop-common/CHANGES.txt
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk #1110 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/1110/ ) HADOOP-12324 . Better exception reporting in SaslPlainServer. (Mike Yoder via stevel) (stevel: rev ca0827a86235dbc4d7e00cc8426ebff9fcc2d421) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslPlainServer.java hadoop-common-project/hadoop-common/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Hdfs-trunk #2297 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2297/)
          HADOOP-12324. Better exception reporting in SaslPlainServer. (Mike Yoder via stevel) (stevel: rev ca0827a86235dbc4d7e00cc8426ebff9fcc2d421)

          • hadoop-common-project/hadoop-common/CHANGES.txt
          • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslPlainServer.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk #2297 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2297/ ) HADOOP-12324 . Better exception reporting in SaslPlainServer. (Mike Yoder via stevel) (stevel: rev ca0827a86235dbc4d7e00cc8426ebff9fcc2d421) hadoop-common-project/hadoop-common/CHANGES.txt hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslPlainServer.java
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #358 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/358/)
          HADOOP-12324. Better exception reporting in SaslPlainServer. (Mike Yoder via stevel) (stevel: rev ca0827a86235dbc4d7e00cc8426ebff9fcc2d421)

          • hadoop-common-project/hadoop-common/CHANGES.txt
          • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslPlainServer.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #358 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/358/ ) HADOOP-12324 . Better exception reporting in SaslPlainServer. (Mike Yoder via stevel) (stevel: rev ca0827a86235dbc4d7e00cc8426ebff9fcc2d421) hadoop-common-project/hadoop-common/CHANGES.txt hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslPlainServer.java
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Mapreduce-trunk #2320 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2320/)
          HADOOP-12324. Better exception reporting in SaslPlainServer. (Mike Yoder via stevel) (stevel: rev ca0827a86235dbc4d7e00cc8426ebff9fcc2d421)

          • hadoop-common-project/hadoop-common/CHANGES.txt
          • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslPlainServer.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk #2320 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2320/ ) HADOOP-12324 . Better exception reporting in SaslPlainServer. (Mike Yoder via stevel) (stevel: rev ca0827a86235dbc4d7e00cc8426ebff9fcc2d421) hadoop-common-project/hadoop-common/CHANGES.txt hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslPlainServer.java
          Hide
          ajisakaa Akira Ajisaka added a comment -

          Closing this issue as the patch is committed to trunk and branch-2.

          Show
          ajisakaa Akira Ajisaka added a comment - Closing this issue as the patch is committed to trunk and branch-2.

            People

            • Assignee:
              yoderme Mike Yoder
              Reporter:
              yoderme Mike Yoder
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development