lhotari opened a new pull request, #4719:
URL: https://github.com/apache/bookkeeper/pull/4719
### Motivation
- Fix issues when using numeric IP or DNS with multiple IPs
- The numeric IP issue is described in
[ZOOKEEPER-3825](https://issues.apache.org/jira/browse/ZOOKEEPER-3825)
- Similar problem exists for DNS name with multiple IPs such as K8S
headless (ClusterIP: None) service
- In the problem, the client disconnects immediately after connecting
and reconnects again
- Other problem is that connecting to a numeric IP is flaky on Java 17,
example stack trace below:
```
[reapable-thread-SendThread(172.18.0.5:2181)] WARN
org.apache.zookeeper.ClientCnxn - Session 0x0 for server
172.18.0.5/<unresolved>:2181, unexpected error, closing socket connection and
attempting reconnect
java.nio.channels.UnresolvedAddressException
at java.base/sun.nio.ch.Net.checkAddress(Net.java:159)
at java.base/sun.nio.ch.Net.checkAddress(Net.java:167)
at
java.base/sun.nio.ch.SocketChannelImpl.checkRemote(SocketChannelImpl.java:816)
at
java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:839)
at
org.apache.zookeeper.ClientCnxnSocketNIO.registerAndConnect(ClientCnxnSocketNIO.java:277)
at
org.apache.zookeeper.ClientCnxnSocketNIO.connect(ClientCnxnSocketNIO.java:287)
at
org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1021)
at
org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1064)
```
### Changes
- Copy `StaticHostProvider` from ZooKeeper
- add new method `isMyServerInNewConfig` which contains the fix to check
if current connection is already in the available servers list
- Implement `StaticHostProvider.Resolver` which resolves numeric ip
addresses immediately by using Netty's
`NetUtil.createInetAddressFromIpAddressString`
- Add tests based on `StaticHostProviderTest` from ZooKeeper
- Add support for testing multiple IP dns names by mocking with
burningwave tools library
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]