You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by xiaosuo <gi...@git.apache.org> on 2017/02/24 06:56:44 UTC

[GitHub] thrift issue #422: THRIFT-3080: fix connection leak of C++ Nonblocking Serve...

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.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---