Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-11694 Über-jira: S3a phase II: robustness, scale and performance
  3. HADOOP-13674

S3A can provide a more detailed error message when accessing a bucket through an incorrect S3 endpoint.

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.8.0, 3.0.0-alpha2
    • Component/s: fs/s3
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      When accessing the S3 service through a region-specific endpoint, the bucket must be located in that region. If the client attempts to access a bucket that is not located in that region, then the service replies with a 301 redirect and the correct region endpoint. However, the exception thrown by S3A does not include the correct endpoint. If we included that information in the exception, it would make it easier for users to diagnose and fix incorrect configuration.

      1. HADOOP-13674-branch-2.001.patch
        13 kB
        Chris Nauroth
      2. HADOOP-13674-branch-2.002.patch
        13 kB
        Chris Nauroth

        Activity

        Hide
        cnauroth Chris Nauroth added a comment -

        Here is the error I see when I attempt to access a bucket in us-west-2, but with fs.s3a.endpoint pointing to us-west-1.

        > hadoop fs -D fs.s3a.endpoint=s3-us-west-1.amazonaws.com -ls s3a://cnauroth-test-aws-s3a-logs/
        ls: getFileStatus on : com.amazonaws.services.s3.model.AmazonS3Exception: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint. (Service: Amazon S3; Status Code: 301; Error Code: PermanentRedirect; Request ID: EC6C7FCF8B40B27C), S3 Extended Request ID: EQ1h4MW2CRLV4ZJBGs2xz2CVXwsfGS5X+ByWfyl1tdzbXbf7bFn5DI5pejcWWCmu1/P/uDEOjaU=: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint. (Service: Amazon S3; Status Code: 301; Error Code: PermanentRedirect; Request ID: EC6C7FCF8B40B27C)
        

        It says that the endpoint is wrong, but it doesn't say which endpoint is correct. Turning on debug logging shows that the information does come back in the HTTP 301 response:

        > hadoop --loglevel DEBUG fs -D fs.s3a.endpoint=s3-us-west-1.amazonaws.com -ls s3a://cnauroth-test-aws-s3a-logs/
        ...
        16/10/03 13:35:28 DEBUG http.wire:  << "<Error><Code>PermanentRedirect</Code><Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message><Bucket>cnauroth-test-aws-s3a-logs</Bucket><Endpoint>cnauroth-test-aws-s3a-logs.s3-us-west-2.amazonaws.com</Endpoint><RequestId>995927D9C5DD8F90</RequestId><HostId>LK/kvbR/gdnxyr5JXj1L41TOfcO4VBF6MtT8FkwOXXyRdjhasccrHc2bux+b4uHSqJmiBEgHJcI=</HostId></Error>"
        ...
        

        It appears that the AWS SDK maps the <Endpoint> element into the map returned by AmazonS3Exception#getAdditionalDetails(). We can use that to get the information and put it into the exception thrown from S3A.

        Show
        cnauroth Chris Nauroth added a comment - Here is the error I see when I attempt to access a bucket in us-west-2, but with fs.s3a.endpoint pointing to us-west-1. > hadoop fs -D fs.s3a.endpoint=s3-us-west-1.amazonaws.com -ls s3a: //cnauroth-test-aws-s3a-logs/ ls: getFileStatus on : com.amazonaws.services.s3.model.AmazonS3Exception: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint. (Service: Amazon S3; Status Code: 301; Error Code: PermanentRedirect; Request ID: EC6C7FCF8B40B27C), S3 Extended Request ID: EQ1h4MW2CRLV4ZJBGs2xz2CVXwsfGS5X+ByWfyl1tdzbXbf7bFn5DI5pejcWWCmu1/P/uDEOjaU=: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint. (Service: Amazon S3; Status Code: 301; Error Code: PermanentRedirect; Request ID: EC6C7FCF8B40B27C) It says that the endpoint is wrong, but it doesn't say which endpoint is correct. Turning on debug logging shows that the information does come back in the HTTP 301 response: > hadoop --loglevel DEBUG fs -D fs.s3a.endpoint=s3-us-west-1.amazonaws.com -ls s3a: //cnauroth-test-aws-s3a-logs/ ... 16/10/03 13:35:28 DEBUG http.wire: << "<Error><Code>PermanentRedirect</Code><Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message><Bucket>cnauroth-test-aws-s3a-logs</Bucket><Endpoint>cnauroth-test-aws-s3a-logs.s3-us-west-2.amazonaws.com</Endpoint><RequestId>995927D9C5DD8F90</RequestId><HostId>LK/kvbR/gdnxyr5JXj1L41TOfcO4VBF6MtT8FkwOXXyRdjhasccrHc2bux+b4uHSqJmiBEgHJcI=</HostId></Error>" ... It appears that the AWS SDK maps the <Endpoint> element into the map returned by AmazonS3Exception#getAdditionalDetails() . We can use that to get the information and put it into the exception thrown from S3A.
        Hide
        cnauroth Chris Nauroth added a comment -

        I'm attaching patch 001. Summary:

        • Add specific exception translation logic for an HTTP 301 response. Include the recommended S3 endpoint and a hint to check fs.s3a.endpoint in the exception message.
        • Update example error in documentation to show that the error message contains the recommended endpoint.
        • Introduce a new unit test suite, TestS3AExceptionTranslation. This consists of tests refactored out of ITestS3AFailureHandling that didn't really have a dependency on the S3 service, a new test for an HTTP 301 response, and several other tests for HTTP status codes that weren't already covered, like 403, 410 and 416.
        Show
        cnauroth Chris Nauroth added a comment - I'm attaching patch 001. Summary: Add specific exception translation logic for an HTTP 301 response. Include the recommended S3 endpoint and a hint to check fs.s3a.endpoint in the exception message. Update example error in documentation to show that the error message contains the recommended endpoint. Introduce a new unit test suite, TestS3AExceptionTranslation . This consists of tests refactored out of ITestS3AFailureHandling that didn't really have a dependency on the S3 service, a new test for an HTTP 301 response, and several other tests for HTTP status codes that weren't already covered, like 403, 410 and 416.
        Hide
        cnauroth Chris Nauroth added a comment -

        I still need to do a full test run against the service.

        Show
        cnauroth Chris Nauroth added a comment - I still need to do a full test run against the service.
        Hide
        hadoopqa Hadoop QA added a comment -
        -1 overall



        Vote Subsystem Runtime Comment
        0 reexec 0m 22s Docker mode activated.
        +1 @author 0m 0s The patch does not contain any @author tags.
        +1 test4tests 0m 0s The patch appears to include 2 new or modified test files.
        +1 mvninstall 6m 49s branch-2 passed
        +1 compile 0m 18s branch-2 passed with JDK v1.8.0_101
        +1 compile 0m 18s branch-2 passed with JDK v1.7.0_111
        +1 checkstyle 0m 15s branch-2 passed
        +1 mvnsite 0m 24s branch-2 passed
        +1 mvneclipse 0m 15s branch-2 passed
        +1 findbugs 0m 34s branch-2 passed
        +1 javadoc 0m 13s branch-2 passed with JDK v1.8.0_101
        +1 javadoc 0m 16s branch-2 passed with JDK v1.7.0_111
        +1 mvninstall 0m 17s the patch passed
        +1 compile 0m 13s the patch passed with JDK v1.8.0_101
        +1 javac 0m 13s the patch passed
        +1 compile 0m 16s the patch passed with JDK v1.7.0_111
        +1 javac 0m 16s the patch passed
        -0 checkstyle 0m 11s hadoop-tools/hadoop-aws: The patch generated 1 new + 0 unchanged - 0 fixed = 1 total (was 0)
        +1 mvnsite 0m 21s the patch passed
        +1 mvneclipse 0m 12s the patch passed
        -1 whitespace 0m 0s The patch 8 line(s) with tabs.
        +1 findbugs 0m 43s the patch passed
        +1 javadoc 0m 11s the patch passed with JDK v1.8.0_101
        +1 javadoc 0m 13s the patch passed with JDK v1.7.0_111
        +1 unit 0m 20s hadoop-aws in the patch passed with JDK v1.7.0_111.
        +1 asflicense 0m 17s The patch does not generate ASF License warnings.
        15m 9s



        Subsystem Report/Notes
        Docker Image:yetus/hadoop:b59b8b7
        JIRA Issue HADOOP-13674
        JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12831467/HADOOP-13674-branch-2.001.patch
        Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
        uname Linux ae1a347cc164 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 branch-2 / 612aa0c
        Default Java 1.7.0_111
        Multi-JDK versions /usr/lib/jvm/java-8-oracle:1.8.0_101 /usr/lib/jvm/java-7-openjdk-amd64:1.7.0_111
        findbugs v3.0.0
        checkstyle https://builds.apache.org/job/PreCommit-HADOOP-Build/10649/artifact/patchprocess/diff-checkstyle-hadoop-tools_hadoop-aws.txt
        whitespace https://builds.apache.org/job/PreCommit-HADOOP-Build/10649/artifact/patchprocess/whitespace-tabs.txt
        JDK v1.7.0_111 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10649/testReport/
        modules C: hadoop-tools/hadoop-aws U: hadoop-tools/hadoop-aws
        Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10649/console
        Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org

        This message was automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 0m 22s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. +1 test4tests 0m 0s The patch appears to include 2 new or modified test files. +1 mvninstall 6m 49s branch-2 passed +1 compile 0m 18s branch-2 passed with JDK v1.8.0_101 +1 compile 0m 18s branch-2 passed with JDK v1.7.0_111 +1 checkstyle 0m 15s branch-2 passed +1 mvnsite 0m 24s branch-2 passed +1 mvneclipse 0m 15s branch-2 passed +1 findbugs 0m 34s branch-2 passed +1 javadoc 0m 13s branch-2 passed with JDK v1.8.0_101 +1 javadoc 0m 16s branch-2 passed with JDK v1.7.0_111 +1 mvninstall 0m 17s the patch passed +1 compile 0m 13s the patch passed with JDK v1.8.0_101 +1 javac 0m 13s the patch passed +1 compile 0m 16s the patch passed with JDK v1.7.0_111 +1 javac 0m 16s the patch passed -0 checkstyle 0m 11s hadoop-tools/hadoop-aws: The patch generated 1 new + 0 unchanged - 0 fixed = 1 total (was 0) +1 mvnsite 0m 21s the patch passed +1 mvneclipse 0m 12s the patch passed -1 whitespace 0m 0s The patch 8 line(s) with tabs. +1 findbugs 0m 43s the patch passed +1 javadoc 0m 11s the patch passed with JDK v1.8.0_101 +1 javadoc 0m 13s the patch passed with JDK v1.7.0_111 +1 unit 0m 20s hadoop-aws in the patch passed with JDK v1.7.0_111. +1 asflicense 0m 17s The patch does not generate ASF License warnings. 15m 9s Subsystem Report/Notes Docker Image:yetus/hadoop:b59b8b7 JIRA Issue HADOOP-13674 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12831467/HADOOP-13674-branch-2.001.patch Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux ae1a347cc164 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 branch-2 / 612aa0c Default Java 1.7.0_111 Multi-JDK versions /usr/lib/jvm/java-8-oracle:1.8.0_101 /usr/lib/jvm/java-7-openjdk-amd64:1.7.0_111 findbugs v3.0.0 checkstyle https://builds.apache.org/job/PreCommit-HADOOP-Build/10649/artifact/patchprocess/diff-checkstyle-hadoop-tools_hadoop-aws.txt whitespace https://builds.apache.org/job/PreCommit-HADOOP-Build/10649/artifact/patchprocess/whitespace-tabs.txt JDK v1.7.0_111 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10649/testReport/ modules C: hadoop-tools/hadoop-aws U: hadoop-tools/hadoop-aws Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10649/console Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
        Hide
        stevel@apache.org Steve Loughran added a comment -

        LGTM

        +1, provided you get rid of those tabs in the stack trace

        Show
        stevel@apache.org Steve Loughran added a comment - LGTM +1, provided you get rid of those tabs in the stack trace
        Hide
        cnauroth Chris Nauroth added a comment -

        Here is patch 002 cleaning up the Checkstyle and whitespace warnings. I'll wait for a pre-commit run and complete a full test pass against the S3 service. Then, I'll commit based on Steve's +1.

        Show
        cnauroth Chris Nauroth added a comment - Here is patch 002 cleaning up the Checkstyle and whitespace warnings. I'll wait for a pre-commit run and complete a full test pass against the S3 service. Then, I'll commit based on Steve's +1.
        Hide
        hadoopqa Hadoop QA added a comment -
        +1 overall



        Vote Subsystem Runtime Comment
        0 reexec 0m 18s Docker mode activated.
        +1 @author 0m 0s The patch does not contain any @author tags.
        +1 test4tests 0m 0s The patch appears to include 2 new or modified test files.
        +1 mvninstall 7m 17s branch-2 passed
        +1 compile 0m 19s branch-2 passed with JDK v1.8.0_101
        +1 compile 0m 19s branch-2 passed with JDK v1.7.0_111
        +1 checkstyle 0m 15s branch-2 passed
        +1 mvnsite 0m 25s branch-2 passed
        +1 mvneclipse 0m 15s branch-2 passed
        +1 findbugs 0m 36s branch-2 passed
        +1 javadoc 0m 13s branch-2 passed with JDK v1.8.0_101
        +1 javadoc 0m 16s branch-2 passed with JDK v1.7.0_111
        +1 mvninstall 0m 18s the patch passed
        +1 compile 0m 15s the patch passed with JDK v1.8.0_101
        +1 javac 0m 15s the patch passed
        +1 compile 0m 18s the patch passed with JDK v1.7.0_111
        +1 javac 0m 18s the patch passed
        +1 checkstyle 0m 12s the patch passed
        +1 mvnsite 0m 22s the patch passed
        +1 mvneclipse 0m 12s the patch passed
        +1 whitespace 0m 0s The patch has no whitespace issues.
        +1 findbugs 0m 45s the patch passed
        +1 javadoc 0m 11s the patch passed with JDK v1.8.0_101
        +1 javadoc 0m 13s the patch passed with JDK v1.7.0_111
        +1 unit 0m 20s hadoop-aws in the patch passed with JDK v1.7.0_111.
        +1 asflicense 0m 16s The patch does not generate ASF License warnings.
        15m 43s



        Subsystem Report/Notes
        Docker Image:yetus/hadoop:b59b8b7
        JIRA Issue HADOOP-13674
        JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12831567/HADOOP-13674-branch-2.002.patch
        Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
        uname Linux ee7f904dd68c 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 branch-2 / a9a2f64
        Default Java 1.7.0_111
        Multi-JDK versions /usr/lib/jvm/java-8-oracle:1.8.0_101 /usr/lib/jvm/java-7-openjdk-amd64:1.7.0_111
        findbugs v3.0.0
        JDK v1.7.0_111 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10658/testReport/
        modules C: hadoop-tools/hadoop-aws U: hadoop-tools/hadoop-aws
        Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10658/console
        Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org

        This message was automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - +1 overall Vote Subsystem Runtime Comment 0 reexec 0m 18s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. +1 test4tests 0m 0s The patch appears to include 2 new or modified test files. +1 mvninstall 7m 17s branch-2 passed +1 compile 0m 19s branch-2 passed with JDK v1.8.0_101 +1 compile 0m 19s branch-2 passed with JDK v1.7.0_111 +1 checkstyle 0m 15s branch-2 passed +1 mvnsite 0m 25s branch-2 passed +1 mvneclipse 0m 15s branch-2 passed +1 findbugs 0m 36s branch-2 passed +1 javadoc 0m 13s branch-2 passed with JDK v1.8.0_101 +1 javadoc 0m 16s branch-2 passed with JDK v1.7.0_111 +1 mvninstall 0m 18s the patch passed +1 compile 0m 15s the patch passed with JDK v1.8.0_101 +1 javac 0m 15s the patch passed +1 compile 0m 18s the patch passed with JDK v1.7.0_111 +1 javac 0m 18s the patch passed +1 checkstyle 0m 12s the patch passed +1 mvnsite 0m 22s the patch passed +1 mvneclipse 0m 12s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 findbugs 0m 45s the patch passed +1 javadoc 0m 11s the patch passed with JDK v1.8.0_101 +1 javadoc 0m 13s the patch passed with JDK v1.7.0_111 +1 unit 0m 20s hadoop-aws in the patch passed with JDK v1.7.0_111. +1 asflicense 0m 16s The patch does not generate ASF License warnings. 15m 43s Subsystem Report/Notes Docker Image:yetus/hadoop:b59b8b7 JIRA Issue HADOOP-13674 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12831567/HADOOP-13674-branch-2.002.patch Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux ee7f904dd68c 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 branch-2 / a9a2f64 Default Java 1.7.0_111 Multi-JDK versions /usr/lib/jvm/java-8-oracle:1.8.0_101 /usr/lib/jvm/java-7-openjdk-amd64:1.7.0_111 findbugs v3.0.0 JDK v1.7.0_111 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10658/testReport/ modules C: hadoop-tools/hadoop-aws U: hadoop-tools/hadoop-aws Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10658/console Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
        Hide
        cnauroth Chris Nauroth added a comment -

        Pre-commit has given a +1, and I have confirmed a full test run passes against US-west-2. I have committed this to trunk, branch-2 and branch-2.8. Steve, thank you for the code review.

        Show
        cnauroth Chris Nauroth added a comment - Pre-commit has given a +1, and I have confirmed a full test run passes against US-west-2. I have committed this to trunk, branch-2 and branch-2.8. Steve, thank you for the code review.
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #10540 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10540/)
        HADOOP-13674. S3A can provide a more detailed error message when (cnauroth: rev 88b9444a81081da9b168d2e290f9552b58a4d8c6)

        • (add) hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AExceptionTranslation.java
        • (edit) hadoop-tools/hadoop-aws/src/site/markdown/tools/hadoop-aws/index.md
        • (edit) hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AUtils.java
        • (edit) hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AFailureHandling.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #10540 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10540/ ) HADOOP-13674 . S3A can provide a more detailed error message when (cnauroth: rev 88b9444a81081da9b168d2e290f9552b58a4d8c6) (add) hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AExceptionTranslation.java (edit) hadoop-tools/hadoop-aws/src/site/markdown/tools/hadoop-aws/index.md (edit) hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AUtils.java (edit) hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AFailureHandling.java

          People

          • Assignee:
            cnauroth Chris Nauroth
            Reporter:
            cnauroth Chris Nauroth
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development