Eliminate uses of `pick_random_unused_tcp_port`
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 75
Description
A common pattern in our integration tests is to call a function `pick_random_unused_tcp_port`, which selects an unused port on, and then tell a server to startup on that port—hoping the port is still unused by the time the server starts. With 27k ports to randomly choose from the chance of another process competing for the same port does not seem too high, but with 72 test actions running in parallel (hence 5k pairs of processes) chances add up, causing a source of flakyness.
While https://bazel-review.googlesource.com/c/bazel/+/94891 fixes the issue for #7893, many more uses of that function remain and will cause problems in the long run.
Contributor guide
Research direction
Search the repository for every use of `pick_random_unused_tcp_port`, then inspect the integration-test call sites and the change referenced for #7893. Determine how each server is started and replace the remaining uses consistently; done means no remaining uses and the affected integration tests pass without port-race failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100