curator icon indicating copy to clipboard operation
curator copied to clipboard

CURATOR-535: Fix client port conflict due to untrustworthy random port allocation

Open kezhuw opened this issue 3 years ago • 0 comments

This commit tries to solve port conflict for TestingServer if port is unspecified(aka. port <= 0):

  • Set InstanceSpec.port to 0 if port is unspecified.
  • Save OS chosen bind port after started to maintain same port across restart.

Ideally, it should be possible to bootstrap TestingCluster(with unspecified ports) too with help from reconfig. But there are difficulties since election port, quorum port were not designed to be bound to 0 in ZooKeeper. TestingServer should be enough for most cases.

Users should resort to other solutions(eg. container) if they got bored by port conflict due to usages of TestingCluster and TestingServer.restart.

kezhuw avatar Jun 14 '22 01:06 kezhuw