Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4500

Unable to stop socket server while there are connected clients

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.11.0
    • None
    • C# - Library
    • None

    Description

      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(); }

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              gambr Gianni Ambrosio
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: