[
https://issues.apache.org/jira/browse/THRIFT-2441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14392929#comment-14392929
]
James E. King, III commented on THRIFT-2441:
--------------------------------------------
The only gotcha I see in this is that the socket-specific server transport
needs to know at creation time of the accepted client whether it is able to
interrupt the client or not, per your requirement that we maintain the old
behavior for folks who cannot tolerate the performance hit of the select call.
This is however an implementation detail of the solution we've been discussing.
If we can remove the requirement to maintain the previous behavior then we
could do as you suggest; the death_listener would always exist and be used, and
would only be used by the TServers provided by the project until anyone's
custom implementation caught up, otherwise I think it would make more sense to
follow your previous suggestion and encapsulate this logic as a contract
between TServerSocket and TSocket.
I believe your previous suggestion was already backwards compatible, since this
new behavior would only be triggered by a call to stop() on the
TServerTransport. A call to interrupt() would behave the same as it does today
so custom TServer implementations could continue to use interrupt() if they
want. I would add stop() to TServerTransport as well as something to indicate
whether the lifetime of the children of the server transport are tied to the
lifetime of the server transport, and change the three TServer implementations
to call stop() instead of interrupt(); the implementer can decide the behavior
by setting it on the TServerSocket, and the default would be to have the
lifetime of the child transports managed by the server transport.
> 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)