hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Masatake Iwasaki (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-13234) Get random port by new ServerSocket(0).getLocalPort() in ServerSocketUtil#getPort
Date Wed, 12 Oct 2016 21:58:20 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-13234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15569974#comment-15569974

Masatake Iwasaki commented on HADOOP-13234:

Thanks for the patch, [~brahmareddy].

I think manual free port searching has an advantage I have not noticed in HDFS-10367.

{{ServerSocket(0).getLocalPort()}} always returns the number in ephemeral port range based
on the platform (e.g. 32768-61000 on Linux and 49152-65535 on Windows).  The current {{getPort{p,
retries)}} tries the range between p and 65535 which is wider than epehmeral port range. It
could be useful to reduce possibility of port collision since client socket always uses ephemeral

I don't have motivation to replace existing code now baced on the fact above. Can you propose
additional advantage of using {{ServerSocket(0).getLocalPort()}}?

> Get random port by new ServerSocket(0).getLocalPort() in ServerSocketUtil#getPort
> ---------------------------------------------------------------------------------
>                 Key: HADOOP-13234
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13234
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Brahma Reddy Battula
>            Assignee: Brahma Reddy Battula
>         Attachments: HADOOP-13234-002.patch, HADOOP-13234.patch
> As per [~iwasakims] comment from [here|https://issues.apache.org/jira/browse/HDFS-10367?focusedCommentId=15275604&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15275604]
> we can get available random port by {{new ServerSocket(0).getLocalPort()}} and it's more

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org

View raw message