instantiating a ClickHouseHttpClient takes almost a minute
vrischmann opened this issue · 0 comments
Describe the bug
I'm currently testing the ClickHouse Java client on macOS and I think there's a bug.
Just instantiating a new ClickHouseHttpClient takes almost a minute on my system. The following code:
logger.info("Before client build");
try (var client = new ClickHouseHttpClient()) {
logger.info("Client created: {}", client);
}
produces this:
07:47:30.336 [main] INFO com.batch.ebt.App -- Before client build
07:48:21.049 [main] INFO com.batch.ebt.App -- Client created: com.clickhouse.client.http.ClickHouseHttpClient@47fd17e3
I ran this code with a debugger, paused the execution and from what I can tell it is stuck doing a reverse-address lookup on a random IP address. The call to getCanonicalHostname
in getLocalhost is what's blocking.
And here you can see the IP address it's calling getCanonicalHostname
on:
That IP comes from this interface but I have no clue what it's used for:
utun8: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
inet6 fe80::88d:79aa:436e:dd72%utun8 prefixlen 64 scopeid 0x1a
nd6 options=201<PERFORMNUD,DAD>
I'm not sure what's the best way to resolve this because it seems specific to macOS, however it would be nice to have the ability to bypass this step and just provide this address ourselves somehow. Right now since it's executed in the ClickHouseHttpClient constructor we can't do anything.
Steps to reproduce
- Create a new basic main application, create a new instance of
ClickHouseHttpClient
- Run the code on macOS
- Observe it takes a long time to finish
Expected behaviour
Code example
See above
Error log
Not applicable here.
Configuration
Environment
- Client version: 0.6.2
- Language version: 22.0.1
- OS: macOS Sonoma 14.5
ClickHouse server
- ClickHouse Server version: version 24.5.4.49 (official build)