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

Ted Wang commented on THRIFT-3753:
----------------------------------

Yes. TServerSocket (the only server transport that implements 
interruptChildren) uses the same socket pair for interruption all children. 
Data is written to the socket to signal the clients and break them out of the 
poll loop. Data is never read so the interrupt signal will not be lost, even if 
a new client were to come in after we have written to the socket.

With that said, I do share some concerns that a future server transport not 
handle the case that you mention correctly.

> TServerFramework::stop may fail to interrupt connected clients
> --------------------------------------------------------------
>
>                 Key: THRIFT-3753
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3753
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9.3
>            Reporter: Ted Wang
>
> This is a sequence that exposes the race condition:
> (1) Thread-1: in serve(), blocked on accept()
> (2) Thread-2: in stop(), calls interrupt()
> (3) Thread-2: in stop(), in interruptChildren(), checked that socket is valid
> (4) Thread-1: in serve(), unblocked because of interrupt(), calls 
> releaseOneDescriptor
> (5) Thread-2: in interruptChildren(), send fails so clients are not 
> interrupted



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

Reply via email to