You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Simon South (JIRA)" <ji...@apache.org> on 2014/08/28 05:09:59 UTC

[jira] [Updated] (THRIFT-2680) c_glib: ThriftFramedTransport fails when peer unexpectedly closes connection

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

Simon South updated THRIFT-2680:
--------------------------------

    Attachment: thrift-2680-2-c_glib-framed-transport-handle-closed-connection-gracefully.patch
                thrift-2680-1-c_glib-test-framed-transport-read-after-peer-close.patch

> c_glib: ThriftFramedTransport fails when peer unexpectedly closes connection
> ----------------------------------------------------------------------------
>
>                 Key: THRIFT-2680
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2680
>             Project: Thrift
>          Issue Type: Bug
>          Components: C glib - Library
>    Affects Versions: 0.9.1
>         Environment: Fedora 20 64-bit on x86_64
>            Reporter: Simon South
>            Priority: Minor
>              Labels: c_glib, library
>         Attachments: thrift-2680-1-c_glib-test-framed-transport-read-after-peer-close.patch, thrift-2680-2-c_glib-framed-transport-handle-closed-connection-gracefully.patch
>
>
> Working on the integration test suite for c_glib exposed a problem with ThriftFramedTransport: If the peer closes the connection unexpectedly, {{thrift_framed_transport_read_frame}} will fail with either a critical GLib warning or a segmentation fault.
> The attached patches fix this issue. The changes are, in order:
> 1. Add a suitable test case to {{testframedtransport.c}}.
> 2. Modify {{thrift_framed_transport_read_frame}} and {{thrift_framed_transport_read_frame_slow}} so they check for and respond to errors returned from other Thrift methods. Additionally, {{thrift_framed_transport_read_frame_slow}} should now always return -1 in case of read error, which includes "successfully" reading zero bytes from the peer (which generally indicates a prematurely closed connection).
> I've also taken the liberty of gently rewriting {{thrift_framed_transport_read_frame}} so it
> * Correctly uses an unsigned integer variable to hold the frame's size,
> * Uses {{thrift_transport_...}} functions to invoke class methods instead of the rather brittle practice of dereferencing class members directly, and
> * Accurately reports success or failure.



--
This message was sent by Atlassian JIRA
(v6.2#6252)