You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by GitBox <gi...@apache.org> on 2023/01/01 10:55:27 UTC

[GitHub] [thrift] dejank-isystem opened a new pull request, #2740: netstd Server: Add IPv6

dejank-isystem opened a new pull request, #2740:
URL: https://github.com/apache/thrift/pull/2740

   Unlike servers in other languages (tested: cpp & python), netstd (Csharp) listens only on IPv4. This can cause errors and delays on clients if they use "localhost" for hostname.
   
   <!-- Explain the changes in the pull request below: -->
   
   
   <!-- We recommend you review the checklist/tips before submitting a pull request. -->
   
   - [ ] Did you create an [Apache Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?  (not required for trivial changes)
   - [ ] If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
   - [ ] Did you squash your changes to a single commit?  (not required, but preferred)
   - [ ] Did you do your best to avoid breaking changes?  If one was needed, did you label the Jira ticket with "Breaking-Change"?
   - [ ] If your change does not involve any code, include `[skip ci]` anywhere in the commit message to free up build resources.
   
   <!--
     The Contributing Guide at:
     https://github.com/apache/thrift/blob/master/CONTRIBUTING.md
     has more details and tips for committing properly.
   -->
   
     PS: Could you update PyPI when this gets released (I guess with version 0.18.0)?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [thrift] dejank-isystem commented on pull request #2740: netstd Server: Add IPv6

Posted by GitBox <gi...@apache.org>.
dejank-isystem commented on PR #2740:
URL: https://github.com/apache/thrift/pull/2740#issuecomment-1359906888

   One mistake, when testing python server, I forgot to close netstd server. Error was in this that python does not listen both on IPv4 and IPv6, but only on IPv6. This can also be fixed with the `IPV6_V6ONLY` option set to `False`.
   
   Also note that listening on both protocols is only valid when no hostname is given.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [thrift] Jens-G commented on pull request #2740: netstd Server: Add IPv6

Posted by GitBox <gi...@apache.org>.
Jens-G commented on PR #2740:
URL: https://github.com/apache/thrift/pull/2740#issuecomment-1368412295

   Thanks!
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [thrift] tisdall commented on pull request #2740: netstd Server: Add IPv6

Posted by "tisdall (via GitHub)" <gi...@apache.org>.
tisdall commented on PR #2740:
URL: https://github.com/apache/thrift/pull/2740#issuecomment-1682227227

   ok.. it's worse then I thought...  IPv4 addresses also fail:
   ```python
   from thrift.transport.TSocket import TServerSocket
   server_socket = TServerSocket(host='0.0.0.0')
   server_socket.listen()
   ```
   
   Output:
   ```
   Traceback (most recent call last):
     File "/Users/ttisdall/repos/bespin/mu.py", line 3, in <module>
       server_socket.listen()
     File "/Users/ttisdall/.local/share/virtualenvs/bespin-uIM29DXQ/lib/python3.9/site-packages/thrift/transport/TSocket.py", line 232, in listen
       self.handle.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
   OSError: [Errno 22] Invalid argument
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [thrift] tisdall commented on pull request #2740: netstd Server: Add IPv6

Posted by "tisdall (via GitHub)" <gi...@apache.org>.
tisdall commented on PR #2740:
URL: https://github.com/apache/thrift/pull/2740#issuecomment-1682266968

   Ah...  it's fixed in #2770 but not in a current release yet.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [thrift] Jens-G commented on pull request #2740: netstd Server: Add IPv6

Posted by GitBox <gi...@apache.org>.
Jens-G commented on PR #2740:
URL: https://github.com/apache/thrift/pull/2740#issuecomment-1368412382

   https://stackoverflow.com/a/28281485/499466


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [thrift] Jens-G merged pull request #2740: netstd Server: Add IPv6

Posted by GitBox <gi...@apache.org>.
Jens-G merged PR #2740:
URL: https://github.com/apache/thrift/pull/2740


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [thrift] Jens-G closed pull request #2740: netstd Server: Add IPv6

Posted by GitBox <gi...@apache.org>.
Jens-G closed pull request #2740: netstd Server: Add IPv6
URL: https://github.com/apache/thrift/pull/2740


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [thrift] tisdall commented on pull request #2740: netstd Server: Add IPv6

Posted by "tisdall (via GitHub)" <gi...@apache.org>.
tisdall commented on PR #2740:
URL: https://github.com/apache/thrift/pull/2740#issuecomment-1681088991

   @Jens-G Not sure how to properly file a bug, but this PR seems to have broken some code when I upgraded to 0.18.1
   
   The issue is that I'm using a unix socket and not a socket capable of IPV6.  Short demo example:
   ```python
   from thrift.transport.TSocket import TServerSocket
   server_socket = TServerSocket(unix_socket='/tmp/test.sock')
   server_socket.listen()
   ```
   
   Output:
   ```
   Traceback (most recent call last):
     File "test.py", line 4, in <module>
       server_socket.listen()
     File "lib/python3.9/site-packages/thrift/transport/TSocket.py", line 232, in listen
       self.handle.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
   OSError: [Errno 102] Operation not supported on socket
   ```
   
   Same issue by using the python interpreter:
   ```
   Python 3.9.13 (main, Jul 27 2022, 08:01:19) 
   [Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import socket
   >>> s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM, 0)
   >>> s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)  # works fine with AF_INET6!
   >>>
   >>> s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0)
   >>> s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
   OSError: [Errno 102] Operation not supported on socket
   ```
   
   Perhaps this should be fixed to be the following?
   ```python
           self.handle = socket.socket(res[0], res[1])
           if not self._unix_socket:
               self.handle.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
           self.handle.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org