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

ASF GitHub Bot commented on THRIFT-4671:
----------------------------------------

jeking3 closed pull request #1635: THRIFT-4671: handle client's unexpected 
close.
URL: https://github.com/apache/thrift/pull/1635
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c 
b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
index 1433725759..8296a8cad1 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
@@ -465,7 +465,7 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType 
type, GError **error)
       }
     case T_STRUCT:
       {
-        guint32 result = 0;
+        gint32 result = 0;
         gchar *name;
         gint16 fid;
         ThriftType ftype;
@@ -475,6 +475,10 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType 
type, GError **error)
         {
           result += thrift_protocol_read_field_begin (protocol, &name, &ftype,
                                                       &fid, error);
+          if (result < 0)
+          {
+            return result;  
+          }
           if (ftype == T_STOP)
           {
             break;
@@ -487,7 +491,7 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType 
type, GError **error)
       }
     case T_SET:
       {
-        guint32 result = 0;
+        gint32 result = 0;
         ThriftType elem_type;
         guint32 i, size;
         result += thrift_protocol_read_set_begin (protocol, &elem_type, &size,
@@ -501,7 +505,7 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType 
type, GError **error)
       }
     case T_MAP:
       {
-        guint32 result = 0;
+        gint32 result = 0;
         ThriftType elem_type;
         ThriftType key_type;
         guint32 i, size;
@@ -517,7 +521,7 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType 
type, GError **error)
       }
     case T_LIST:
       {
-        guint32 result = 0;
+        gint32 result = 0;
         ThriftType elem_type;
         guint32 i, size;
         result += thrift_protocol_read_list_begin (protocol, &elem_type, &size,


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> c glib is unable to handle client close unexpectedly
> ----------------------------------------------------
>
>                 Key: THRIFT-4671
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4671
>             Project: Thrift
>          Issue Type: Bug
>          Components: C glib - Library
>    Affects Versions: 0.11.0
>         Environment: ubuntu 16.04 
> thrift sever: c_glib
> thrift client: c_glib, go
>            Reporter: lixiasong
>            Priority: Major
>              Labels: easyfix, ready-to-commit
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> When using c_glib thrift server. Once a client connects to the server *but 
> does nothing (didn't send data to server) when being connected*. If the 
> client closed unexpectedly(such as being killed) at the moment, *the 
> thrift-work thread for that client wont't be closed* and read the closed 
> client sock fd in the server forever.
> *I*t has been fixed in my branch, and will be tested and committed later if 
> it runs well.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to