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

James E. King, III commented on THRIFT-2441:
--------------------------------------------

interrupt() means the TServerTransport breaks out of a blocking call and throws 
TTransportException(INTERRUPTED).

So it makes sense that interruptServerAndChildren() would cause both the server 
and every child to do the same thing.
Unfortunately there is no precedent for handling INTERRUPTED in 
TServer/TTransport(child) processing loops.  If anyone is providing their own 
TServer, they may not expect INTERRUPTED in the processor loop and that may 
turn into an error message.

Do you think it is better to maintain the meaning of interrupt() and throw an 
INTERRUPTED from the child read() and let people update their server 
implementations to handle this without an error, or is it better to return 0 
from the TTransport::read() when interrupted and let all existing TServers 
(Thrift’s and third party) to handle it as if the client disconnected?  My 
concern about the latter is that is makes “interrupt” mean something different 
for the clients than it does for the server, and it should really mean the same 
thing.  I'm going to proceed with the child, if interrupted, throw a 
TTransportException(INTERRUPTED) and update the three TServers to ignore this 
(right now they would log it because it isn't END_OF_FILE).


> Cannot shutdown TThreadedServer when clients are still connected
> ----------------------------------------------------------------
>
>                 Key: THRIFT-2441
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2441
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9.1
>            Reporter: Chris Stylianou
>            Assignee: Ben Craig
>
> When calling stop() on the TThreadedServer no interrupts are sent to the 
> client threads. This means the stop() call blocks on tasksMonitor.wait() 
> until all client naturally disconnect.
> How can we tell the client thread connections to close/exit during the 
> TThreadedServer::stop() call?



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

Reply via email to