[ 
https://issues.apache.org/jira/browse/GEODE-5674?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Smith updated GEODE-5674:
-----------------------------
    Description: 
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.

  was:
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 can be picked up by another connection.

If we did not assign ports randomly, but instead iterated over a pool of ports, 
we would not return the same port twice until exhaust the pool, and we would be 
much less likely to get a port collision from two calls to AvailablePortHelper.


> 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
>            Priority: Major
>              Labels: swat
>
> 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