Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2975

Graceful handing of unexpected errors

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.9.2
    • None
    • Python - Compiler
    • None

    Description

      Currently, the Python compiler generate Processor.process_* methods that look something like,

      def process_myMethod(...):
        myArg = ...
        try:
          result.success = self._handler.myMethod(myArg)
        except ExpectedException, e:
          result.exc = ...
      

      If handler.myMethod throws an exception that was not defined in the service interface (due to a bug, for example), the client connection is terminated without any extra information being sent down. This is unideal because the client dos not know whether the issue was a networking error or a server-side problem.

      A possibly better behavior would be,

      def process_myMethod(...):
        myArg = ...
        try:
          self._handler.myMethod(myArg)
        except ExpectedException, e:
          ...
        except Exception:
          exc = TApplicationException(INTERNAL_ERROR)
          # write exc to output protocol as an exception
      

      The generated clients already expect TApplicationException in the response and know how to parse and handle them, so this won't require any change on the client side.

      Note that this will leave the connection open for further requests. My understanding is that there are some security concerns around that. So perhaps the behavior could be that process_* throws a TApplicationException and Processor.process catches it, sends it to the client and terminates the connection.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            abg Abhinav Gupta

            Dates

              Created:
              Updated:

              Slack

                Issue deployment