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 2015/07/26 02:18:04 UTC

[jira] [Updated] (THRIFT-3269) error handling issue in SimpleServer

     [ https://issues.apache.org/jira/browse/THRIFT-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jens Geyer updated THRIFT-3269:
-------------------------------
    Attachment: simple-server.patch

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)