You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Ivan Murashko (JIRA)" <ji...@apache.org> on 2010/10/24 14:54:21 UTC

[jira] Created: (THRIFT-966) Bind to zero port

Bind to zero port
-----------------

                 Key: THRIFT-966
                 URL: https://issues.apache.org/jira/browse/THRIFT-966
             Project: Thrift
          Issue Type: Improvement
          Components: C++ - Library
            Reporter: Ivan Murashko
             Fix For: 0.6
         Attachments: bindinfo_retrieval.diff

apache::thrift::transport::TServerSocket class has a possibility to set 0 as port number. In this case bind will assign a free port number. Unfortunately there is no possibility to retrieve the assigned port number from the TServerSocket class. Thus clients will not be able to connect the server.

The suggested patch introduces apache::thrift::transport::TServerSocket::getBindPort() method that return the assigned port number or -1 in the case of any failure or when the port has not been assigned yet.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-966) Bind to zero port

Posted by "Ivan Murashko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-966?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ivan Murashko updated THRIFT-966:
---------------------------------

    Attachment: bindinfo_retrieval.diff

The suggested patch introduces apache::thrift::transport::TServerSocket::getBindPort() method that return the assigned port number or -1 in the case of any failure or when the port has not been assigned yet.

> Bind to zero port
> -----------------
>
>                 Key: THRIFT-966
>                 URL: https://issues.apache.org/jira/browse/THRIFT-966
>             Project: Thrift
>          Issue Type: Improvement
>          Components: C++ - Library
>            Reporter: Ivan Murashko
>             Fix For: 0.6
>
>         Attachments: bindinfo_retrieval.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> apache::thrift::transport::TServerSocket class has a possibility to set 0 as port number. In this case bind will assign a free port number. Unfortunately there is no possibility to retrieve the assigned port number from the TServerSocket class. Thus clients will not be able to connect the server.
> The suggested patch introduces apache::thrift::transport::TServerSocket::getBindPort() method that return the assigned port number or -1 in the case of any failure or when the port has not been assigned yet.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-966) Bind to zero port

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12924765#action_12924765 ] 

David Reiss commented on THRIFT-966:
------------------------------------

Could you do the lookup when it's requested so that users who bind to a specified port (most of us) don't have to pay the cost?

> Bind to zero port
> -----------------
>
>                 Key: THRIFT-966
>                 URL: https://issues.apache.org/jira/browse/THRIFT-966
>             Project: Thrift
>          Issue Type: Improvement
>          Components: C++ - Library
>            Reporter: Ivan Murashko
>             Fix For: 0.6
>
>         Attachments: bindinfo_retrieval.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> apache::thrift::transport::TServerSocket class has a possibility to set 0 as port number. In this case bind will assign a free port number. Unfortunately there is no possibility to retrieve the assigned port number from the TServerSocket class. Thus clients will not be able to connect the server.
> The suggested patch introduces apache::thrift::transport::TServerSocket::getBindPort() method that return the assigned port number or -1 in the case of any failure or when the port has not been assigned yet.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-966) Bind to zero port

Posted by "Ivan Murashko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12924926#action_12924926 ] 

Ivan Murashko commented on THRIFT-966:
--------------------------------------

Some comments about how it can be used:
- TServerSocket is got 0 as port number during the server initialization
- The real assigned port number can be got via TServerEventHandler::preServe and stored somewhere (at a DB for example). Thus a client can always know is the server started and on which port.

The feature is really necessary if we have a lot of services defined at a .thrift file. It's very hard to guarantee that the manually assigned ports are not used by any other application.  In the case of 0 port we will get the guarantee.

The feature is requested time to time. For example there are several requests on ICE by ZeroC about the same feature: 
http://www.zeroc.com/forums/help-center/2600-how-know-port-adapter-using.html

BTW: About the solution cost: I don't think that one additional method and ~10 lines of code is a huge price for the feature

> Bind to zero port
> -----------------
>
>                 Key: THRIFT-966
>                 URL: https://issues.apache.org/jira/browse/THRIFT-966
>             Project: Thrift
>          Issue Type: Improvement
>          Components: C++ - Library
>            Reporter: Ivan Murashko
>             Fix For: 0.6
>
>         Attachments: bindinfo_retrieval.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> apache::thrift::transport::TServerSocket class has a possibility to set 0 as port number. In this case bind will assign a free port number. Unfortunately there is no possibility to retrieve the assigned port number from the TServerSocket class. Thus clients will not be able to connect the server.
> The suggested patch introduces apache::thrift::transport::TServerSocket::getBindPort() method that return the assigned port number or -1 in the case of any failure or when the port has not been assigned yet.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.