[
https://issues.apache.org/jira/browse/THRIFT-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14641804#comment-14641804
]
Jens Geyer edited comment on THRIFT-3269 at 7/26/15 12:26 AM:
--------------------------------------------------------------
The code in SimpleServer looks like this:
{code}
ok, err := processor.Process(inputProtocol, outputProtocol)
if err, ok := err.(TTransportException); ok && err.TypeId() == END_OF_FILE {
return nil
} else if err != nil {
log.Printf("error processing request: %s", err)
return err
}
{code}
The problem is, if {{processor.Process()}} returns anything else than a
{{TTransportException}} (for example a {{TProtocolException}}, then the {{err}}
variable becomes {{nil}} and the second {{if}} condition is never met.
As a result, the error state is gone, not reported and no longer available.
[This patch|^simple-server.patch] fixes the error handling issue, but raises
the second part of the problem.
was (Author: jensg):
The code in SimpleServer looks like this:
{code}
ok, err := processor.Process(inputProtocol, outputProtocol)
if err2, ok := err.(TTransportException); ok && err2.TypeId() == END_OF_FILE {
return nil
} else if err != nil {
log.Printf("error processing request: %s", err)
return err
}
{code}
The problem is, if {{processor.Process()}} returns anything else than a
{{TTransportException}} (for example a {{TProtocolException}}, then {{err}}
becomes nil and the second if condition is never met. As a result, the error
state is gone, not reported and no longer available.
[This patch|^simple-server.patch] fixes the error handling issue, but raises
the second part of the problem.
> error handling issue in SimpleServer
> ------------------------------------
>
> Key: THRIFT-3269
> URL: https://issues.apache.org/jira/browse/THRIFT-3269
> Project: Thrift
> Issue Type: Bug
> Components: Go - Library
> Reporter: Jens Geyer
> Attachments: simple-server.patch
>
>
> There is error handling issue in SimpleServer, which supresses errors instead
> of properly handling them. If the comparingly simple fix is applied, one of
> the Xception test fails all of a sudden.
> {code}
> 2015/07/26 01:52:32 error processing request: TException
> 2015/07/26 01:52:32 error processing request: TException
> --- FAIL: TestTJSONProtocol (0.06s)
> thrifttest_driver.go:224: TestException Xception failed
> 2015/07/26 01:52:32 error processing request: TException
> 2015/07/26 01:52:32 error processing request: TException
> --- FAIL: TestTBinaryProtocol (0.08s)
> thrifttest_driver.go:224: TestException Xception failed
> 2015/07/26 01:52:32 error processing request: TException
> 2015/07/26 01:52:32 error processing request: TException
> --- FAIL: TestTCompactProtocol (0.07s)
> thrifttest_driver.go:224: TestException Xception failed
> FAIL
> FAIL tests 0.398s
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)