Driver has the following logic when using advanced shard awareness:
- Produce an iterator of port numbers to try to bind locally to.
- Iterate over it.
- For each port:
- Try to open connection using this local port
- If it works, great. If not, check if the error indicates that the port is occupied
- If it is, try next port
- If it is not, return the error
Turns out that when reuseaddr is enabled, a different error (AddrNotAvailable) is returned for occupied port, making adv shard awareness not resilient to occupied ports.
Driver has the following logic when using advanced shard awareness:
Turns out that when reuseaddr is enabled, a different error (
AddrNotAvailable) is returned for occupied port, making adv shard awareness not resilient to occupied ports.