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

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

Github user jeking3 commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/422#discussion_r28515512
  
    --- Diff: lib/cpp/src/thrift/server/TNonblockingServer.cpp ---
    @@ -1393,9 +1397,42 @@ bool 
TNonblockingIOThread::notify(TNonblockingServer::TConnection* conn) {
         return false;
       }
     
    -  const int kSize = sizeof(conn);
    -  if (send(fd, const_cast_sockopt(&conn), kSize, 0) != kSize) {
    -    return false;
    +  fd_set wfds, efds;
    +  int ret = -1;
    +  int kSize = sizeof(conn);
    +  const char * pos = (const char *)const_cast_sockopt(&conn);
    +
    +  while (kSize > 0) {
    +    FD_ZERO(&wfds);
    +    FD_ZERO(&efds);
    +    FD_SET(fd, &wfds);
    +    FD_SET(fd, &efds);
    +    ret = select(fd + 1, NULL, &wfds, &efds, NULL);
    --- End diff --
    
    Fair enough, I read the first page of the manual and saw nfds and made an 
assumption!
    
    Should we be using THRIFT_POLL here similar to how TSocket does so that it 
is [more] compatible cross-platform?


> C++ TNonblockingServer connection leak while accept huge number connections.
> ----------------------------------------------------------------------------
>
>                 Key: THRIFT-3080
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3080
>             Project: Thrift
>          Issue Type: Bug
>    Affects Versions: 0.9.2
>            Reporter: Lei FW
>            Assignee: Roger Meier
>            Priority: Critical
>             Fix For: 0.9.3
>
>
> while huge number connections are accepted, the send() syscall on the unix 
> socket for the IO Thread may fail and return EAGAIN, but no one care about 
> the failed sent fd, neither retry nor clean.



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

Reply via email to