maomaodev opened a new issue, #7712:
URL: https://github.com/apache/kyuubi/issues/7712

   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   
   
   ### Search before asking
   
   - [x] I have searched in the 
[issues](https://github.com/apache/kyuubi/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Describe the bug
   
   **1. Describe the Bug**
   
   Kyuubi fails to discover or connect to server/engine endpoints when running 
in an IPv6-only cluster. The server side 
(`DiscoveryClient.parseInstanceHostPort`) and the standalone JDBC client side 
(`ZooKeeperHiveClientHelper`) both parse a `host:port` string by splitting on 
`":"`. This is incorrect for IPv6 because IPv6 addresses themselves contain 
colons.
   
   For example, an endpoint registered to ZooKeeper as: 
`fc00:172:0:0:0:0:0:47a:10009` (IPv6 without brackets) 
   is split into 8 segments instead of `host` + `port`, so the host is wrongly 
resolved as `fc00` and the port as `172`. This results in either a 
`NumberFormatException` or a `UnknownHostException: fc00` when the client tries 
to connect.
   
   **2. Root cause**
   
   Host/port parsing relies on naive `split(":")`, which is only correct for 
IPv4 and hostnames. Hive already solved this in 
`org.apache.hadoop.hive.common.IPStackUtils` by using `lastIndexOf(':')` and 
handling square brackets around IPv6 addresses. Kyuubi has no equivalent 
utility, so IPv6-only deployments break.
   
   **3. Expected behavior**
   
   Kyuubi should correctly parse IPv4, IPv6 (with or without square brackets), 
and hostname `host:port` strings on both the server side and the standalone 
JDBC client side, so that service discovery works in IPv6-only clusters.
   
   ### Affects Version(s)
   
   master
   
   ### Kyuubi Server Log Output
   
   ```logtalk
   
   ```
   
   ### Kyuubi Engine Log Output
   
   ```logtalk
   
   ```
   
   ### Kyuubi Server Configurations
   
   ```yaml
   
   ```
   
   ### Kyuubi Engine Configurations
   
   ```yaml
   
   ```
   
   ### Additional context
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [x] Yes. I would be willing to submit a PR with guidance from the Kyuubi 
community to fix.
   - [ ] No. I cannot submit a PR at this time.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to