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

Unix Domain Socket Support in Objective-C

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.11.0
    • Component/s: Cocoa - Library
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      I would like to be able to use Unix Domain Sockets as the transport to communicate between different processes on a single machine. There seems to be support in the C++ and Python libraries (the two other languages used in my project), but no support in Objective-C.

      Proposed server interface:
      TSocketServer *server = [[TSocketServer alloc] initWithPath:@"/path/to/pipe" protocolFactory:protocolFactory processorFactory:processorFactory];

      Proposed client interface:
      TSocketTransport *socket = [[TSocketTransport alloc] initWithPath:@"/path/to/pipe"];

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user gaoshanyu commented on the issue:

          https://github.com/apache/thrift/pull/1031

          Who can tell me why the cocoa lib has Swift2.3 codes? Where I can download full Objective-C lib? Or is there a way to make the lib to support Swift 3 +?

          Show
          githubbot ASF GitHub Bot added a comment - Github user gaoshanyu commented on the issue: https://github.com/apache/thrift/pull/1031 Who can tell me why the cocoa lib has Swift2.3 codes? Where I can download full Objective-C lib? Or is there a way to make the lib to support Swift 3 +?
          Hide
          jking3 James E. King, III added a comment -

          Committed - thanks. I found THRIFT-3100 describes the desire to add crosstest support for cocoa, so I linked it to this ticket as related.

          Show
          jking3 James E. King, III added a comment - Committed - thanks. I found THRIFT-3100 describes the desire to add crosstest support for cocoa, so I linked it to this ticket as related.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/thrift/pull/1031

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/thrift/pull/1031
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jeking3 commented on the issue:

          https://github.com/apache/thrift/pull/1031

          Okay, well I'm going to approve and merge, and open a Jira item to add crosstest support for cocoa (if not there, I'll check) and for unix sockets in cocoa.

          Show
          githubbot ASF GitHub Bot added a comment - Github user jeking3 commented on the issue: https://github.com/apache/thrift/pull/1031 Okay, well I'm going to approve and merge, and open a Jira item to add crosstest support for cocoa (if not there, I'll check) and for unix sockets in cocoa.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user clindsay commented on the issue:

          https://github.com/apache/thrift/pull/1031

          I've been using it in a project since last summer, communicating between a python process and a Swift/Objective-C process. The project has been in beta with a few hundred users, and no reports of any issues attributable to this yet. I've also written a set of unit tests, testing the behavior of a server and client in the same process both using this transport, that are all passing.

          So yes, it's definitely at least working in these two scenarios.

          Show
          githubbot ASF GitHub Bot added a comment - Github user clindsay commented on the issue: https://github.com/apache/thrift/pull/1031 I've been using it in a project since last summer, communicating between a python process and a Swift/Objective-C process. The project has been in beta with a few hundred users, and no reports of any issues attributable to this yet. I've also written a set of unit tests, testing the behavior of a server and client in the same process both using this transport, that are all passing. So yes, it's definitely at least working in these two scenarios.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jeking3 commented on the issue:

          https://github.com/apache/thrift/pull/1031

          Have you used this in a project and know that it works? Given this is an improvement I'd like to get it in, but if you don't have time right now to add make cross support, I can add a story in Jira to complete the work.

          Show
          githubbot ASF GitHub Bot added a comment - Github user jeking3 commented on the issue: https://github.com/apache/thrift/pull/1031 Have you used this in a project and know that it works? Given this is an improvement I'd like to get it in, but if you don't have time right now to add make cross support, I can add a story in Jira to complete the work.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user clindsay commented on the issue:

          https://github.com/apache/thrift/pull/1031

          Hey @jeking3, sorry for going silent there. I've had a lot of other things on my plate, and haven't gotten to this yet, but I still intend to add this support when I have a chance!

          Show
          githubbot ASF GitHub Bot added a comment - Github user clindsay commented on the issue: https://github.com/apache/thrift/pull/1031 Hey @jeking3, sorry for going silent there. I've had a lot of other things on my plate, and haven't gotten to this yet, but I still intend to add this support when I have a chance!
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jeking3 commented on the issue:

          https://github.com/apache/thrift/pull/1031

          Hi @clindsay just checking in to see if you had made any progress on adding cross test support for cocoa. If not that's okay... it would be really nice to have it though.

          Show
          githubbot ASF GitHub Bot added a comment - Github user jeking3 commented on the issue: https://github.com/apache/thrift/pull/1031 Hi @clindsay just checking in to see if you had made any progress on adding cross test support for cocoa. If not that's okay... it would be really nice to have it though.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jeking3 commented on the issue:

          https://github.com/apache/thrift/pull/1031

          If there isn't one there yet I would recommend following the pattern for java in there. Specifically you would need a new test/ subdirectory for cocoa with test_client and test_server scripts, and you would need a stanza in tests.json that the test.py script could run.

          You can test your scripts against a single client or server like this, after running a "make" following configure in test/:

          ./test.py --client cocoa --server java
          ./test.py --client java --server cocoa

          You could substitute cpp for java as well. Then when those pass, try a "make cross" to see if everything passes.

          Show
          githubbot ASF GitHub Bot added a comment - Github user jeking3 commented on the issue: https://github.com/apache/thrift/pull/1031 If there isn't one there yet I would recommend following the pattern for java in there. Specifically you would need a new test/ subdirectory for cocoa with test_client and test_server scripts, and you would need a stanza in tests.json that the test.py script could run. You can test your scripts against a single client or server like this, after running a "make" following configure in test/: ./test.py --client cocoa --server java ./test.py --client java --server cocoa You could substitute cpp for java as well. Then when those pass, try a "make cross" to see if everything passes.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user clindsay commented on the issue:

          https://github.com/apache/thrift/pull/1031

          Thanks @jeking3. Sorry for the slow response, a bit busy these days!

          Just to clarify, as far as I can tell there isn't a cocoa test client today. Is this correct? So, in order to add these tests to "make cross", we would first need to add a "cocoa" folder to `thrift/test`, and put together a test server, and test client executable that could participate in these tests?

          Show
          githubbot ASF GitHub Bot added a comment - Github user clindsay commented on the issue: https://github.com/apache/thrift/pull/1031 Thanks @jeking3. Sorry for the slow response, a bit busy these days! Just to clarify, as far as I can tell there isn't a cocoa test client today. Is this correct? So, in order to add these tests to "make cross", we would first need to add a "cocoa" folder to `thrift/test`, and put together a test server, and test client executable that could participate in these tests?
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jeking3 commented on the issue:

          https://github.com/apache/thrift/pull/1031

          To enable "make cross" support you can follow the pattern in test/tests.json to add the "domain" transport to your cocoa test. Your cocoa test_client needs to understand that transport and create the correct kind of client, etc.

          Show
          githubbot ASF GitHub Bot added a comment - Github user jeking3 commented on the issue: https://github.com/apache/thrift/pull/1031 To enable "make cross" support you can follow the pattern in test/tests.json to add the "domain" transport to your cocoa test. Your cocoa test_client needs to understand that transport and create the correct kind of client, etc.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user clindsay commented on the issue:

          https://github.com/apache/thrift/pull/1031

          No problem. Just rebased on master. I will work on adding to the "make cross" test.

          Show
          githubbot ASF GitHub Bot added a comment - Github user clindsay commented on the issue: https://github.com/apache/thrift/pull/1031 No problem. Just rebased on master. I will work on adding to the "make cross" test.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jeking3 commented on the issue:

          https://github.com/apache/thrift/pull/1031

          Would it be possible to rebase this on master so we can get a clean CI build? Also enabling unix socket transport in the "make cross" test would be really nice to validate this code.

          Show
          githubbot ASF GitHub Bot added a comment - Github user jeking3 commented on the issue: https://github.com/apache/thrift/pull/1031 Would it be possible to rebase this on master so we can get a clean CI build? Also enabling unix socket transport in the "make cross" test would be really nice to validate this code.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user clindsay commented on the issue:

          https://github.com/apache/thrift/pull/1031

          The diff generated by GitHub makes the change look a little bigger than it actually is. In TSocketServer.m, the `initWithSocket` method is effectively the same as the old `initWithPort` method, but with the socket creation code factored out into `createSocketWithPort`. Additional code has been added to create a socket using a path instead of a port.

          Show
          githubbot ASF GitHub Bot added a comment - Github user clindsay commented on the issue: https://github.com/apache/thrift/pull/1031 The diff generated by GitHub makes the change look a little bigger than it actually is. In TSocketServer.m, the `initWithSocket` method is effectively the same as the old `initWithPort` method, but with the socket creation code factored out into `createSocketWithPort`. Additional code has been added to create a socket using a path instead of a port.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user clindsay commented on the issue:

          https://github.com/apache/thrift/pull/1031

          I have written unit tests for this change, but am not sure where to contribute them. I see no "cocoa" directory under the "test" directory. Is there another place where I can contribute my unit tests?

          Show
          githubbot ASF GitHub Bot added a comment - Github user clindsay commented on the issue: https://github.com/apache/thrift/pull/1031 I have written unit tests for this change, but am not sure where to contribute them. I see no "cocoa" directory under the "test" directory. Is there another place where I can contribute my unit tests?
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user clindsay opened a pull request:

          https://github.com/apache/thrift/pull/1031

          THRIFT-3859: Add support for Unix Domain Sockets to TSocketServer and TSocketTransport

          Existing behavior for port-based socket transport should be unchanged by this commit. TSocketServer and TSocketTransport have been refactored to support sockets created using either a port or a path.

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/clindsay/thrift thrift-3859

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/thrift/pull/1031.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #1031


          commit 291a05a0ce62f9eb4351e7f61f7d051223e37cba
          Author: Chris Vasselli <cvasselli@box.com>
          Date: 2016-06-21T23:45:39Z

          THRIFT-3859: Add support for Unix Domain Sockets to TSocketServer and TSocketTransport.

          Existing behavior for port-based socket transport should be unchanged by this commit. TSocketServer and TSocketTransport have been refactored to support sockets created using either a port or a path.


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user clindsay opened a pull request: https://github.com/apache/thrift/pull/1031 THRIFT-3859 : Add support for Unix Domain Sockets to TSocketServer and TSocketTransport Existing behavior for port-based socket transport should be unchanged by this commit. TSocketServer and TSocketTransport have been refactored to support sockets created using either a port or a path. You can merge this pull request into a Git repository by running: $ git pull https://github.com/clindsay/thrift thrift-3859 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/thrift/pull/1031.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1031 commit 291a05a0ce62f9eb4351e7f61f7d051223e37cba Author: Chris Vasselli <cvasselli@box.com> Date: 2016-06-21T23:45:39Z THRIFT-3859 : Add support for Unix Domain Sockets to TSocketServer and TSocketTransport. Existing behavior for port-based socket transport should be unchanged by this commit. TSocketServer and TSocketTransport have been refactored to support sockets created using either a port or a path.

            People

            • Assignee:
              jking3 James E. King, III
              Reporter:
              cvasselli Chris Vasselli
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development