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

Exception may be swallowed in KMSClientProvider

    Details

    • Hadoop Flags:
      Reviewed

      Description

      In KMSClientProvider# createConnection

            try {
              is = conn.getInputStream();
              ret = mapper.readValue(is, klass);
            } catch (IOException ex) {
              if (is != null) {
                is.close(); <== close may throw exception
              }
              throw ex;
            } finally {
              if (is != null) {
                is.close();
              }
            }
          }
      

      ex may be swallowed when close highlighted in the code throws exception. Thanks Harsh J for pointing this out.

      BTW, I think we should be able to consolidate the two is.close() in the above code, so we don't close the same stream twice. The one in the finally block may be called after an exception is thrown or not, and it may throw exception too, we need to be careful not to swallow exception here too.

      1. HADOOP-12604.001.patch
        1 kB
        Yongjun Zhang
      2. HADOOP-12604.002.patch
        2 kB
        Yongjun Zhang

        Activity

        Hide
        stevel@apache.org Steve Loughran added a comment -

        .. and they should use IOUtils.closeStream()

        Show
        stevel@apache.org Steve Loughran added a comment - .. and they should use IOUtils.closeStream()
        Hide
        yzhangal Yongjun Zhang added a comment -

        Hi Steve Loughran,

        Thanks for your comments, would you please help taking a look at the patch? Thanks.

        Show
        yzhangal Yongjun Zhang added a comment - Hi Steve Loughran , Thanks for your comments, would you please help taking a look at the patch? Thanks.
        Hide
        hadoopqa Hadoop QA added a comment -
        -1 overall



        Vote Subsystem Runtime Comment
        0 reexec 0m 0s Docker mode activated.
        +1 @author 0m 0s The patch does not contain any @author tags.
        -1 test4tests 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 mvninstall 8m 26s trunk passed
        +1 compile 9m 2s trunk passed with JDK v1.8.0_66
        +1 compile 9m 35s trunk passed with JDK v1.7.0_85
        +1 checkstyle 0m 17s trunk passed
        +1 mvnsite 1m 7s trunk passed
        +1 mvneclipse 0m 15s trunk passed
        +1 findbugs 1m 57s trunk passed
        +1 javadoc 1m 0s trunk passed with JDK v1.8.0_66
        +1 javadoc 1m 10s trunk passed with JDK v1.7.0_85
        +1 mvninstall 1m 42s the patch passed
        +1 compile 8m 54s the patch passed with JDK v1.8.0_66
        +1 javac 8m 54s the patch passed
        +1 compile 9m 35s the patch passed with JDK v1.7.0_85
        -1 javac 24m 18s root-jdk1.7.0_85 with JDK v1.7.0_85 generated 1 new issues (was 746, now 746).
        +1 javac 9m 35s the patch passed
        +1 checkstyle 0m 16s the patch passed
        +1 mvnsite 1m 6s the patch passed
        +1 mvneclipse 0m 15s the patch passed
        +1 whitespace 0m 0s Patch has no whitespace issues.
        +1 findbugs 2m 11s the patch passed
        +1 javadoc 0m 59s the patch passed with JDK v1.8.0_66
        +1 javadoc 1m 11s the patch passed with JDK v1.7.0_85
        +1 unit 7m 42s hadoop-common in the patch passed with JDK v1.8.0_66.
        +1 unit 7m 51s hadoop-common in the patch passed with JDK v1.7.0_85.
        -1 asflicense 0m 16s Patch generated 1 ASF License warnings.
        76m 3s



        Subsystem Report/Notes
        Docker Image:yetus/hadoop:0ca8df7
        JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12775926/HADOOP-12604.001.patch
        JIRA Issue HADOOP-12604
        Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
        uname Linux cf9767fbd17f 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
        Build tool maven
        Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
        git revision trunk / 86c95cb
        findbugs v3.0.0
        javac root-jdk1.7.0_85: https://builds.apache.org/job/PreCommit-HADOOP-Build/8183/artifact/patchprocess/diff-compile-javac-root-jdk1.7.0_85.txt
        JDK v1.7.0_85 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/8183/testReport/
        asflicense https://builds.apache.org/job/PreCommit-HADOOP-Build/8183/artifact/patchprocess/patch-asflicense-problems.txt
        modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common
        Max memory used 76MB
        Powered by Apache Yetus http://yetus.apache.org
        Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/8183/console

        This message was automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 0m 0s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. -1 test4tests 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 mvninstall 8m 26s trunk passed +1 compile 9m 2s trunk passed with JDK v1.8.0_66 +1 compile 9m 35s trunk passed with JDK v1.7.0_85 +1 checkstyle 0m 17s trunk passed +1 mvnsite 1m 7s trunk passed +1 mvneclipse 0m 15s trunk passed +1 findbugs 1m 57s trunk passed +1 javadoc 1m 0s trunk passed with JDK v1.8.0_66 +1 javadoc 1m 10s trunk passed with JDK v1.7.0_85 +1 mvninstall 1m 42s the patch passed +1 compile 8m 54s the patch passed with JDK v1.8.0_66 +1 javac 8m 54s the patch passed +1 compile 9m 35s the patch passed with JDK v1.7.0_85 -1 javac 24m 18s root-jdk1.7.0_85 with JDK v1.7.0_85 generated 1 new issues (was 746, now 746). +1 javac 9m 35s the patch passed +1 checkstyle 0m 16s the patch passed +1 mvnsite 1m 6s the patch passed +1 mvneclipse 0m 15s the patch passed +1 whitespace 0m 0s Patch has no whitespace issues. +1 findbugs 2m 11s the patch passed +1 javadoc 0m 59s the patch passed with JDK v1.8.0_66 +1 javadoc 1m 11s the patch passed with JDK v1.7.0_85 +1 unit 7m 42s hadoop-common in the patch passed with JDK v1.8.0_66. +1 unit 7m 51s hadoop-common in the patch passed with JDK v1.7.0_85. -1 asflicense 0m 16s Patch generated 1 ASF License warnings. 76m 3s Subsystem Report/Notes Docker Image:yetus/hadoop:0ca8df7 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12775926/HADOOP-12604.001.patch JIRA Issue HADOOP-12604 Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux cf9767fbd17f 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 Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / 86c95cb findbugs v3.0.0 javac root-jdk1.7.0_85: https://builds.apache.org/job/PreCommit-HADOOP-Build/8183/artifact/patchprocess/diff-compile-javac-root-jdk1.7.0_85.txt JDK v1.7.0_85 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/8183/testReport/ asflicense https://builds.apache.org/job/PreCommit-HADOOP-Build/8183/artifact/patchprocess/patch-asflicense-problems.txt modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common Max memory used 76MB Powered by Apache Yetus http://yetus.apache.org Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/8183/console This message was automatically generated.
        Hide
        stevel@apache.org Steve Loughran added a comment -
        • license failure is unrelated
        • the javac warning is in KMSClientProvider, but its some existing code elsewhere
        • can you cut out the catch (IOException ex) clause entirely, now that all it does is rethrow ex?
        Show
        stevel@apache.org Steve Loughran added a comment - license failure is unrelated the javac warning is in KMSClientProvider, but its some existing code elsewhere can you cut out the catch (IOException ex) clause entirely, now that all it does is rethrow ex?
        Hide
        yzhangal Yongjun Zhang added a comment -

        Thanks Steve Loughran, nice suggestion. Uploaded a revised version. I also changed another similar place.

        Show
        yzhangal Yongjun Zhang added a comment - Thanks Steve Loughran , nice suggestion. Uploaded a revised version. I also changed another similar place.
        Hide
        hadoopqa Hadoop QA added a comment -
        -1 overall



        Vote Subsystem Runtime Comment
        0 reexec 0m 0s Docker mode activated.
        +1 @author 0m 0s The patch does not contain any @author tags.
        -1 test4tests 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 mvninstall 10m 53s trunk passed
        +1 compile 16m 15s trunk passed with JDK v1.8.0_66
        +1 compile 13m 41s trunk passed with JDK v1.7.0_91
        +1 checkstyle 0m 21s trunk passed
        +1 mvnsite 1m 28s trunk passed
        +1 mvneclipse 0m 18s trunk passed
        +1 findbugs 2m 31s trunk passed
        +1 javadoc 1m 22s trunk passed with JDK v1.8.0_66
        +1 javadoc 1m 28s trunk passed with JDK v1.7.0_91
        +1 mvninstall 2m 2s the patch passed
        +1 compile 14m 25s the patch passed with JDK v1.8.0_66
        +1 javac 14m 25s the patch passed
        +1 compile 13m 41s the patch passed with JDK v1.7.0_91
        -1 javac 35m 30s root-jdk1.7.0_91 with JDK v1.7.0_91 generated 1 new issues (was 746, now 746).
        +1 javac 13m 41s the patch passed
        +1 checkstyle 0m 26s the patch passed
        +1 mvnsite 1m 38s the patch passed
        +1 mvneclipse 0m 24s the patch passed
        +1 whitespace 0m 0s Patch has no whitespace issues.
        +1 findbugs 3m 11s the patch passed
        +1 javadoc 1m 46s the patch passed with JDK v1.8.0_66
        +1 javadoc 1m 40s the patch passed with JDK v1.7.0_91
        -1 unit 11m 7s hadoop-common in the patch failed with JDK v1.8.0_66.
        -1 unit 10m 19s hadoop-common in the patch failed with JDK v1.7.0_91.
        -1 asflicense 0m 27s Patch generated 3 ASF License warnings.
        111m 33s



        Reason Tests
        JDK v1.8.0_66 Failed junit tests hadoop.fs.TestLocalFsFCStatistics
          hadoop.fs.TestSymlinkLocalFSFileSystem
          hadoop.fs.shell.find.TestPrint0
          hadoop.test.TestTimedOutTestsListener
          hadoop.fs.shell.find.TestFind
        JDK v1.7.0_91 Failed junit tests hadoop.fs.TestLocalFsFCStatistics
          hadoop.fs.shell.find.TestPrint
          hadoop.fs.shell.find.TestName
          hadoop.fs.shell.find.TestFind
          hadoop.ipc.TestIPC



        Subsystem Report/Notes
        Docker Image:yetus/hadoop:0ca8df7
        JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12776209/HADOOP-12604.002.patch
        JIRA Issue HADOOP-12604
        Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
        uname Linux 5f8d481c7e4d 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
        Build tool maven
        Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
        git revision trunk / fc47084
        findbugs v3.0.0
        javac root-jdk1.7.0_91: https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/artifact/patchprocess/diff-compile-javac-root-jdk1.7.0_91.txt
        unit https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common-jdk1.8.0_66.txt
        unit https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common-jdk1.7.0_91.txt
        unit test logs https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common-jdk1.8.0_66.txt https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common-jdk1.7.0_91.txt
        JDK v1.7.0_91 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/testReport/
        asflicense https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/artifact/patchprocess/patch-asflicense-problems.txt
        modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common
        Max memory used 75MB
        Powered by Apache Yetus http://yetus.apache.org
        Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/console

        This message was automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 0m 0s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. -1 test4tests 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 mvninstall 10m 53s trunk passed +1 compile 16m 15s trunk passed with JDK v1.8.0_66 +1 compile 13m 41s trunk passed with JDK v1.7.0_91 +1 checkstyle 0m 21s trunk passed +1 mvnsite 1m 28s trunk passed +1 mvneclipse 0m 18s trunk passed +1 findbugs 2m 31s trunk passed +1 javadoc 1m 22s trunk passed with JDK v1.8.0_66 +1 javadoc 1m 28s trunk passed with JDK v1.7.0_91 +1 mvninstall 2m 2s the patch passed +1 compile 14m 25s the patch passed with JDK v1.8.0_66 +1 javac 14m 25s the patch passed +1 compile 13m 41s the patch passed with JDK v1.7.0_91 -1 javac 35m 30s root-jdk1.7.0_91 with JDK v1.7.0_91 generated 1 new issues (was 746, now 746). +1 javac 13m 41s the patch passed +1 checkstyle 0m 26s the patch passed +1 mvnsite 1m 38s the patch passed +1 mvneclipse 0m 24s the patch passed +1 whitespace 0m 0s Patch has no whitespace issues. +1 findbugs 3m 11s the patch passed +1 javadoc 1m 46s the patch passed with JDK v1.8.0_66 +1 javadoc 1m 40s the patch passed with JDK v1.7.0_91 -1 unit 11m 7s hadoop-common in the patch failed with JDK v1.8.0_66. -1 unit 10m 19s hadoop-common in the patch failed with JDK v1.7.0_91. -1 asflicense 0m 27s Patch generated 3 ASF License warnings. 111m 33s Reason Tests JDK v1.8.0_66 Failed junit tests hadoop.fs.TestLocalFsFCStatistics   hadoop.fs.TestSymlinkLocalFSFileSystem   hadoop.fs.shell.find.TestPrint0   hadoop.test.TestTimedOutTestsListener   hadoop.fs.shell.find.TestFind JDK v1.7.0_91 Failed junit tests hadoop.fs.TestLocalFsFCStatistics   hadoop.fs.shell.find.TestPrint   hadoop.fs.shell.find.TestName   hadoop.fs.shell.find.TestFind   hadoop.ipc.TestIPC Subsystem Report/Notes Docker Image:yetus/hadoop:0ca8df7 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12776209/HADOOP-12604.002.patch JIRA Issue HADOOP-12604 Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux 5f8d481c7e4d 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 Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / fc47084 findbugs v3.0.0 javac root-jdk1.7.0_91: https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/artifact/patchprocess/diff-compile-javac-root-jdk1.7.0_91.txt unit https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common-jdk1.8.0_66.txt unit https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common-jdk1.7.0_91.txt unit test logs https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common-jdk1.8.0_66.txt https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common-jdk1.7.0_91.txt JDK v1.7.0_91 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/testReport/ asflicense https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/artifact/patchprocess/patch-asflicense-problems.txt modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common Max memory used 75MB Powered by Apache Yetus http://yetus.apache.org Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/8197/console This message was automatically generated.
        Hide
        yzhangal Yongjun Zhang added a comment -

        The failed tests appear irrelevant. Hi Steve Loughran, would you please look at the new rev to see if it's good for you? thanks.

        Show
        yzhangal Yongjun Zhang added a comment - The failed tests appear irrelevant. Hi Steve Loughran , would you please look at the new rev to see if it's good for you? thanks.
        Hide
        yzhangal Yongjun Zhang added a comment -

        Hi Steve Loughran, would you please help taking a look at the latest patch? Thanks much.

        Show
        yzhangal Yongjun Zhang added a comment - Hi Steve Loughran , would you please help taking a look at the latest patch? Thanks much.
        Hide
        zhz Zhe Zhang added a comment -

        Thanks Yongjun for the work and Steve for the review.

        The latest patch LGTM. +1.

        Show
        zhz Zhe Zhang added a comment - Thanks Yongjun for the work and Steve for the review. The latest patch LGTM. +1.
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-trunk-Commit #9050 (See https://builds.apache.org/job/Hadoop-trunk-Commit/9050/)
        HADOOP-12604. Exception may be swallowed in KMSClientProvider. (Yongjun (yzhang: rev 28bd138018bea6fc9c3bfb94c7a4143420f02ced)

        • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/kms/KMSClientProvider.java
        • hadoop-common-project/hadoop-common/CHANGES.txt
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-trunk-Commit #9050 (See https://builds.apache.org/job/Hadoop-trunk-Commit/9050/ ) HADOOP-12604 . Exception may be swallowed in KMSClientProvider. (Yongjun (yzhang: rev 28bd138018bea6fc9c3bfb94c7a4143420f02ced) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/kms/KMSClientProvider.java hadoop-common-project/hadoop-common/CHANGES.txt
        Hide
        yzhangal Yongjun Zhang added a comment -

        Thanks Steve Loughran and Zhe Zhang much for the review. I committed to trunk, branch-2 and 2.8 branches.

        Show
        yzhangal Yongjun Zhang added a comment - Thanks Steve Loughran and Zhe Zhang much for the review. I committed to trunk, branch-2 and 2.8 branches.

          People

          • Assignee:
            yzhangal Yongjun Zhang
            Reporter:
            yzhangal Yongjun Zhang
          • Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development