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

Ruby server swallows information about unexpected exceptions in handlers

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 0.9.3
    • Fix Version/s: None
    • Component/s: Ruby - Library
    • Labels:
      None

      Description

      After closing of issue THRIFT-3335 the Ruby server catches all exceptions from handlers and sends ApplicationException.new(ApplicationException::INTERNAL_ERROR, 'Internal error') losing all information. It makes investigation of rare failures hard.

      Possible way for investigation is rewriting of Thrift::Processor::process with printing to stdout

      processor.rb
          def process(iprot, oprot)
            name, type, seqid  = iprot.read_message_begin
            if respond_to?("process_#{name}")
              begin
                send("process_#{name}", seqid, iprot, oprot)
              rescue => e
                p e
                x = ApplicationException.new(ApplicationException::INTERNAL_ERROR, 'Internal error')
                write_error(x, oprot, name, seqid)
              end
              true
            else
              iprot.skip(Types::STRUCT)
              iprot.read_message_end
              x = ApplicationException.new(ApplicationException::UNKNOWN_METHOD, 'Unknown function '+name)
              write_error(x, oprot, name, seqid)
              false
            end
          end
      

      (I used it for debug)

      or alternatively wrap the original exception in ApplicationException

      processor.rb
          def process(iprot, oprot)
            name, type, seqid  = iprot.read_message_begin
            if respond_to?("process_#{name}")
              begin
                send("process_#{name}", seqid, iprot, oprot)
              rescue => e
                x = ApplicationException.new(ApplicationException::INTERNAL_ERROR, e.to_s)
                write_error(x, oprot, name, seqid)
              end
              true
            else
              iprot.skip(Types::STRUCT)
              iprot.read_message_end
              x = ApplicationException.new(ApplicationException::UNKNOWN_METHOD, 'Unknown function '+name)
              write_error(x, oprot, name, seqid)
              false
            end
          end
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              alxpo Alexey Porotnikov
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: