You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/12/17 01:00:00 UTC
[GitHub] [geode] demery-pivotal opened a new pull request #5861: GEODE-8404: Make tests use AvailablePortHelper, not AvailablePort
demery-pivotal opened a new pull request #5861:
URL: https://github.com/apache/geode/pull/5861
Make nearly all tests use AvailablePortHelper instead of AvailablePort
to obtain ports. See the rationale below.
Also: Remove unused methods from AvailablePort.
Rationale:
AvailablePort is inherently risky as a source of ports for tests.
Each "get available port" method obtains candidate port numbers from the
desired range by randomly sampling with replacement. This means that
multiple calls can return the same port number if the port is not put
into use between calls.
Some tests failed intermittently because they made multiple calls to
AvailablePort, received the same port on multiple calls, and unknowingly
attempted bind multiple sockets to the same port number, resulting in a
BindException. See GEODE-6622 for examples.
AvailablePortHelper does not have this problem. It obtains candidate
port numbers round robin. After returning an available port,
AvailablePortHelper will not return that port again in that JVM until it
has tested every other port in the range for availability.
To reduce the chance of different JVMs selecting each other's ports,
AvailablePortHelper selects a random starting point for its round robin
search in each JVM.
For distributed tests, DUnit further arranges for the
AvailablePortHelper in each JVM to start its round robin search in a
distinct place, maximally distant from the starting points of all other
JVMs. Because AvailablePort selects randomly from the full port range,
it cannot benefit from this techique.
The problems caused by AvailablePort are rare, but inevitable, with a
frequency determined by the total size of the port range. An upcoming
change will make the available port range much smaller (~400 ports
instead of the current ~10000 ports), which will greatly increase the
frequency of this problem. But the problem exists now, and results in
intermittent BindExceptions.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] demery-pivotal merged pull request #5861: GEODE-8404: Make tests use AvailablePortHelper, not AvailablePort
Posted by GitBox <gi...@apache.org>.
demery-pivotal merged pull request #5861:
URL: https://github.com/apache/geode/pull/5861
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org