thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gianni Ambrosio (JIRA)" <j...@apache.org>
Subject [jira] [Created] (THRIFT-4500) Unable to stop socket server while there are connected clients
Date Tue, 27 Feb 2018 16:24:00 GMT
Gianni Ambrosio created THRIFT-4500:
---------------------------------------

             Summary: Unable to stop socket server while there are connected clients
                 Key: THRIFT-4500
                 URL: https://issues.apache.org/jira/browse/THRIFT-4500
             Project: Thrift
          Issue Type: Bug
          Components: C# - Library
    Affects Versions: 0.11.0
            Reporter: Gianni Ambrosio


I implemented a thrift server with TSimpleServer in a C# application: 
 
public class ThriftServer 
{ 
   public void start(){ 
      Service.Processor processor = new Service.Processor(serviceHandler); 
      TServerSocket serverTransport = new TServerSocket(ServiceConstants.ServicePort);

      server = new TSimpleServer(processor, serverTransport); 
      workerThread = new Thread(new ThreadStart(run)); 
      workerThread.Start(); 
   } 
   private void run(){ 
      server.Serve(); 
   } 
   public void stop(){ 
      server.Stop(); 
   } 
} 

Moreover I implemented a C++ application for the thrift client.
When a client is connected to the C# server, there's no way to exit the C# application. In
fact server.Server() is blocked and server.Stop() does nothing to make the Serve() call exiting.
If I close the C++ application (so the related thrift client) the server.Serve() call returns
immediately and the C# application ends.

In release 0.11.0 the blocking call is at line 137 of TSimpleServer.cs:
 if (!inputTransport.Peek())

Following implementation is useless in this case.

public override void Stop()
 {
 stop = true;
 serverTransport.Close();
 }



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message