Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-6903

Correct mapping of exceptions to HTTP codes

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • S3
    • None

    Description

      Today, the handling of user related exceptions, i.e. OMException, is inconsistent across endpoints. Sometimes, OMException are "manually" converted to OS3Exception, .e.g. here or here, then correctly mapped to 4xx responses by OS3ExceptionMapper.

      Yet occasionally, OS3Exceptions are left unhandled and by default resolved to 500 - Internal Server Errors. For instance:

      sh-4.2$ aws s3api --endpoint http://localhost:9878 list-objects --bucket bucket_3
      An error occurred (500) when calling the ListObjects operation (reached max retries: 4): Internal Server Error 
      2022-06-17 02:33:19,466 [qtp1912821769-23] WARN server.HttpChannel: handleException /bucket_3 INVALID_BUCKET_NAME org.apache.hadoop.ozone.om.exceptions.OMException: Bucket or Volume name has an unsupported character : _2022-06-17 02:33:19,466 [qtp1912821769-23] WARN server.HttpChannelState: unhandled due to prior sendErrorjavax.servlet.ServletException: javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: INVALID_BUCKET_NAME org.apache.hadoop.ozone.om.exceptions.OMException: Bucket or Volume name has an unsupported character : _at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:162)at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)at org.eclipse.jetty.server.Server.handle(Server.java:516)at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:386)at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)at java.base/java.lang.Thread.run(Thread.java:829)Caused by: javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: INVALID_BUCKET_NAME org.apache.hadoop.ozone.om.exceptions.OMException: Bucket or Volume name has an unsupported character : _at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:410)at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:366) 

      We need to implement an exception mapper to convert all OMException to correct response codes.  ...

      The complete mapping can be built based on the Exception/ResultCode and matching them with the error codes from S3 API.

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              duongnguyen Duong
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: