You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2016/02/25 21:44:18 UTC

[jira] [Commented] (THRIFT-3671) Ruby server swallows information about unexpected exceptions in handlers

    [ https://issues.apache.org/jira/browse/THRIFT-3671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15167842#comment-15167842 ] 

Jens Geyer commented on THRIFT-3671:
------------------------------------

Hi [~alxpo],

what about [putting this into a patch file or pull request|http://thrift.apache.org/docs/HowToContribute] that we can review?

> Ruby server swallows information about unexpected exceptions in handlers
> ------------------------------------------------------------------------
>
>                 Key: THRIFT-3671
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3671
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Ruby - Library
>    Affects Versions: 0.9.3
>            Reporter: Alexey Porotnikov
>
> 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
> {code:title=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
> {code}
> (I used it for debug)
> or alternatively wrap the original exception in ApplicationException
> {code:title=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
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)