You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Randy Abernethy (JIRA)" <ji...@apache.org> on 2015/04/01 01:04:53 UTC

[jira] [Commented] (THRIFT-2441) Cannot shutdown TThreadedServer when clients are still connected

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

Randy Abernethy commented on THRIFT-2441:
-----------------------------------------

The interrupt() method allows the TServerSocket to be well encapsulated. It owns the listening socket and handles socket all actions on the socket (like closing). A server might call TServerSocket::interrupt() to break out of the accept call and stop accepting connections (in a pause type of operation) without disconnecting existing clients or closing the listening socket. The server could then again call accept() on the TSocketServer when it would like to once again begin accepting connections, in the meantime connections would backlog up to the backlog limit. 

For example TSimpleServer, TThreadedServer and TThreadPoolServer all trap TTransportException::INTERRUPTED exceptions during serve() processing (though they just continue after the catch). Apache Thrift is a framework though and you do not have to use the prebuilt servers to leverage the framework. Thus TServerSocket needs to be a well encapsulated and generally useful class for encapsulating listening sockets. You may choose not to use the prebuilt servers but find TServerSocket useful (this discussion and those like it are exactly why many roll their own servers).

> 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: Roger Meier
>
> 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)