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

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

Github user xiaosuo commented on the issue:

    https://github.com/apache/thrift/pull/422
  
    This patch may introduce a more serious problem in theory.
    
    No standard defines writing to a socket is an atomic operation, so if 
writing is interleaved by other threads, the reading end will end up with an 
invalid connection pointer, and the following operation on connection will 
cause segment fault.
    
    In order to fix the above issue, we must turn to pipe(2), which guarantees 
that writing data less than PIPE_BUF is atomic . And pipes are more efficient 
than sockets, because no skb is required to save small pointers.
    
    BTW, if we don't set the writing end to nonblocking mode, we don't need to 
use select to emulate it.


> 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.15#6346)

Reply via email to