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

Jonathan Heard commented on THRIFT-3447:
----------------------------------------

I've looked a bit more into this and written a very stripped down test client 
and server using your excerpt as a starting point on the server. 
My client opens the transport but doesn't actually make any RPC calls to the 
Server.

Looking at Parallel Stacks after stopping the server thread I can see that the 
client threads will not notice the stop request until either the underlying 
System.Net.Socket (In this particular case) receives at least one byte, or 
times out (which I think is probably a really long time in TCP).

Just for reference - The server's Serve() thread does complete, so it should 
definitely not accept any new client connections. However, the client threads 
will stay blocked until the above scenario. 

Unfortunately as Thrift is targeted at .NET 3.5 the use of CancellationToken 
isn't available until .NET 4 which is a pity as that's quite a nice way to 
handle such things... It'll have to be resolved another way.

I'll have a look at this further tomorrow to see if I can suggest an elegant 
solution. I'm most concerned about is whether there's a neat way to do this so 
that it doesn't cause issues with Transports which are not based on Sockets.  
Given that there are at least some similarities with the C++ case (I've not 
read it in full detail), it may be prudent to implement a similar solution.



> Cannot shutdown TThreadPoolServer when clients are still connected
> ------------------------------------------------------------------
>
>                 Key: THRIFT-3447
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3447
>             Project: Thrift
>          Issue Type: Bug
>          Components: C# - Library
>    Affects Versions: 0.9.1, 0.9.3
>            Reporter: Tobias Stampfl
>
> When calling Stop() on the TThreadPoolServer, Serve() is still blocking, till 
> the last client disconnected. I do not know if this is intentional, but how 
> can I stop the server without depending on the clients. Killing the Thread 
> that runs Serve() is not really what i want.
> There was a similar Bug in the C++ Library: 
> [THRIFT-2441|https://issues.apache.org/jira/browse/THRIFT-2441]



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

Reply via email to