You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/06/24 00:19:59 UTC

[GitHub] [hadoop-ozone] maobaolong edited a comment on pull request #1110: HDDS-3843. Throw the specific exception other than NPE.

maobaolong edited a comment on pull request #1110:
URL: https://github.com/apache/hadoop-ozone/pull/1110#issuecomment-648490053


   @bharatviswa504 Thank you for your reply, can get the debug screenshot from the related Jira ticket, the result is complete auth header missing, and after i new the ~/.aws/credentials file on the goofys machine, and specify  the default profile by `goofys --profile default -o allow_other --file-mode=0777 --dir-mode=0777 --endpoint http://localhost:9878  user1 /data/home/micahzhao/testdir`
   
   the credentials file content is
   [default]
   aws_access_key_id=12345678
   aws_secret_access_key=12345678
   
   if i do that, the auth header will appear, and the NPE log will gone from the s3g log.
   
   So, you mean, we should keep s3g's behavior consistent with aws s3?, If so, we should throw the MALFORMED_HEADER exception and should catch it and just only log it.
   
   The following is the OzoneClientProducer#getClient. 
   
   ```java
   private OzoneClient getClient(OzoneConfiguration config) throws IOException {
       try {
         String awsAccessId = v4RequestParser.getAwsAccessId();
         UserGroupInformation remoteUser =
             UserGroupInformation.createRemoteUser(awsAccessId);
         if (OzoneSecurityUtil.isSecurityEnabled(config)) {
           LOG.debug("Creating s3 auth info for client.");
           try {
   
             OzoneTokenIdentifier identifier = new OzoneTokenIdentifier();
             identifier.setTokenType(S3AUTHINFO);
             identifier.setStrToSign(v4RequestParser.getStringToSign());
             identifier.setSignature(v4RequestParser.getSignature());
             identifier.setAwsAccessId(awsAccessId);
             identifier.setOwner(new Text(awsAccessId));
             if (LOG.isTraceEnabled()) {
               LOG.trace("Adding token for service:{}", omService);
             }
             Token<OzoneTokenIdentifier> token = new Token(identifier.getBytes(),
                 identifier.getSignature().getBytes(UTF_8),
                 identifier.getKind(),
                 omService);
             remoteUser.addToken(token);
           } catch (OS3Exception | URISyntaxException ex) {
             LOG.error("S3 auth info creation failed.");
             throw S3_AUTHINFO_CREATION_ERROR;
           }
   
         }
         UserGroupInformation.setLoginUser(remoteUser);
       } catch (Exception e) {
         LOG.error("Error: ", e);
       }
   
       if (omServiceID == null) {
         return OzoneClientFactory.getRpcClient(ozoneConfiguration);
       } else {
         // As in HA case, we need to pass om service ID.
         return OzoneClientFactory.getRpcClient(omServiceID, ozoneConfiguration);
       }
     }
   ```
   
   The inconsistent point is 
   
   ```java
    catch (Exception e) {
         LOG.error("Error: ", e);
       }
   ```
   
   It eat the exception only left a log.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org