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

Pass on errors like "connection closed" to the handler module

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.9
    • 0.9
    • Erlang - Library
    • None
    • Patch Available

    Description

      Currently "connection closed" type errors are reported using the error_logger module and, normally, printed to the console as

      'Request' had an error: {{badmatch,
                                {{protocol,thrift_binary_protocol,
                                  {binary_protocol,
                                   {transport,thrift_buffered_transport,
                                    {buffered_transport,
                                     {transport,thrift_socket_transport,
                                      {data,#Port<0.2092>,infinity}},
                                     []}},
                                   true,true}},
                                 {error,closed}}},
                               [{thrift_processor,send_reply,5,[]},
                                {thrift_processor,handle_function,3,[]},
                                {thrift_processor,loop,1,[]}]}
      

      The message above can be reproduced by setting up an Erlang based Thrift server using the binary protocol and socket transport, letting the client connect and issue a command and, before the command reply has been sent from the server, let the client forcefully terminate the connection (for example by killing the client process).

      There is no easy way for the service callback module to suppress this message and there is no way for it to know if the connection has been closed. I'd like information about errors in the thrift server code to be passed on to the service callback module before the process exits. That way the service implementor can choose how to handle errors like "connection closed".

      I've attached an implementation which fixes this good enough for my own use as a patch to thrift_processor.erl.

      Attachments

        Activity

          People

            Unassigned Unassigned
            loxybjorn Björn Bylander
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: