You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Ahmed Hussein (Jira)" <ji...@apache.org> on 2020/10/19 21:33:00 UTC
[jira] [Updated] (HADOOP-17314) Reduce port collisions in JUnits
[ https://issues.apache.org/jira/browse/HADOOP-17314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ahmed Hussein updated HADOOP-17314:
-----------------------------------
Attachment: HADOOP-17314.001.patch
> Reduce port collisions in JUnits
> --------------------------------
>
> Key: HADOOP-17314
> URL: https://issues.apache.org/jira/browse/HADOOP-17314
> Project: Hadoop Common
> Issue Type: Bug
> Reporter: Ahmed Hussein
> Assignee: Ahmed Hussein
> Priority: Major
> Attachments: HADOOP-17314.001.patch
>
>
> Several Junit tests passes a non-zero port number to {{ServerSocketUtil.getPort()}}.
> I noticed that those non-zero values are shared between test methods. Based, on the implementation of {{ServerSocketUtil.getPort()}}, the port is checked then, the socket is closed immediately.
> Two concurrent tests can have the same port number, but one of them fails with binding exceptions.
> Passing a zero port number reduces the probability of returning the same port numbers in two different tests, because the {{ServerSocketUtil.getPort()}} will call a random port number.
> An example of that is as described in HDFS-15618. {{testRead()}} between {{TestBlockTokenWithDFSStriped}} and {{TestBlockTokenWithDFS}} where port 19870 is used by the two test cases.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org