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

Unable to stop socket server while there are connected clients

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            gambr Gianni Ambrosio

            Dates

              Created:
              Updated:

              Slack

                Issue deployment