[ 
https://issues.apache.org/jira/browse/GEODE-5674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16719863#comment-16719863
 ] 

ASF subversion and git services commented on GEODE-5674:
--------------------------------------------------------

Commit f9322996d8f12b136f83162edc4a87699dbbad23 in geode's branch 
refs/heads/feature/GEODE-6143-5 from [~browe]
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=f932299 ]

GEODE-5674: Stop using random values for test ports (#2958)

It seems our test framework will fairly frequently have test failing due to
multiple users trying to bind the same port number.  This happens when the
different users happen to randomly generate the same port.  To keep this from
happening, this change will simply hand out the available ports consecutively
as the test runs.  For dunit tests, each child vm will be given a portion of
the overall range for their use.

> Stop picking ports randomly for tests
> -------------------------------------
>
>                 Key: GEODE-5674
>                 URL: https://issues.apache.org/jira/browse/GEODE-5674
>             Project: Geode
>          Issue Type: Improvement
>            Reporter: Dan Smith
>            Assignee: Brian Rowe
>            Priority: Major
>              Labels: pull-request-available, swat
>             Fix For: 1.9.0
>
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> Our tests currently use AvailablePortHelper and AvailablePort to find a 
> random port that is not in use.
> However, this can lead to port collisions because after the port is returned, 
> it is available until something binds to that socket. In the mean time, other 
> calls to getAvailablePort can return the same port, with around 0.01% chance, 
> since the range is 10000 ports.
> If we did not pick ports randomly, but instead iterated over a pool of ports, 
> we would not return the same port twice until exhaust the pool. We therefore 
> not get the same port twice in a test.
> We would need to handle the fact that dunit tests have multiple VMs, so we 
> need either a central available port service or a unique pool of ports for 
> each process or something like that.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to