Dale Emery created GEODE-9725:
---------------------------------

             Summary: AvailablePort inherently incompatible with default 
membership port range
                 Key: GEODE-9725
                 URL: https://issues.apache.org/jira/browse/GEODE-9725
             Project: Geode
          Issue Type: Bug
          Components: tests
    Affects Versions: 1.15.0
            Reporter: Dale Emery


{{AvailablePortHelperIntegrationTest}} failed in CI:
 
[https://concourse.apachegeode-ci.info/teams/main/pipelines/apache-develop-main/jobs/integration-test-openjdk8/builds/259]

*Cause:* {{AvailablePort}} and {{AvailablePortHelper}} have methods to retrieve 
an "available" port from the membership port range. This feature is both 
unnecessary and inherently unreliable.

*Inherently unreliable:* The default membership port range overlaps each OS's 
ephemeral port range. An ephemeral port deemed to be "available" by one of 
these methods can be put into use by another process even before the method 
returns. It is not safe to rely on such a port to remain available after it is 
checked.

*Unnecessary:* Currently the only callers that request ports from the 
membership port range are two tests in {{DistributedSystemDUnitTest}}. In each 
case, the test uses the returned ports to +set+ the membership port range for a 
member. There is no need for the ports to come from any particular range.

There are no other uses of this feature, either in the product or in tests.

*Solution:* Remove this feature from {{AvailablePort}} and 
{{AvailablePortHelper}}.

*Alternatives:*
 * {{DistributedSystemDUnitTest}} can get available ports from the available 
port range. This range is safe to use (assuming all other concurrently-running 
tests are well-behaved).
 * A caller that needs ports in a specific range can call 
{{AvailablePort.getRandomAvailablePortInRange(lower, upper, protocol)}}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to