-
Notifications
You must be signed in to change notification settings - Fork 595
Closed
Labels
client-api-v2investigatingInvestigation of a root cause is on goingInvestigation of a root cause is on goingv2-feedback
Description
Describe the bug
When spawning more than 16 requests in parallel to a ClickHouse server using the Java HTTP client, all requests will hang and eventually time out (unless I also set MAX_THREADS_PER_CLIENT=1
or greater):
#error {
:cause nil
:via
[{:type java.util.concurrent.ExecutionException
:message com.clickhouse.client.ClickHouseException: Code: 159. Execution timed out
:at [java.util.concurrent.FutureTask report FutureTask.java 122]}
{:type com.clickhouse.client.ClickHouseException
:message Code: 159. Execution timed out
:at [com.clickhouse.client.ClickHouseException of ClickHouseException.java 147]}
{:type java.util.concurrent.TimeoutException
:message nil
:at [java.util.concurrent.CompletableFuture timedGet CompletableFuture.java 1960]}]
:trace
[[java.util.concurrent.CompletableFuture timedGet CompletableFuture.java 1960]
[java.util.concurrent.CompletableFuture get CompletableFuture.java 2095]
[com.clickhouse.client.ClickHouseClient executeAndWait ClickHouseClient.java 878]
[ch_timeout_mwe$execute_BANG_ invokeStatic ch_timeout_mwe.clj 34]
[ch_timeout_mwe$execute_BANG_ invoke ch_timeout_mwe.clj 31]
[ch_timeout_mwe$ping invokeStatic ch_timeout_mwe.clj 40]
[ch_timeout_mwe$ping invoke ch_timeout_mwe.clj 36]
[ch_timeout_mwe$_main$iter__158__162$fn__163$fn__164$fn__165 invoke ch_timeout_mwe.clj 56]
[clojure.core$binding_conveyor_fn$fn__5823 invoke core.clj 2047]
[clojure.lang.AFn call AFn.java 18]
[java.util.concurrent.FutureTask run FutureTask.java 317]
[java.util.concurrent.ThreadPoolExecutor runWorker ThreadPoolExecutor.java 1144]
[java.util.concurrent.ThreadPoolExecutor$Worker run ThreadPoolExecutor.java 642]
[java.lang.Thread run Thread.java 1583]]}
Afterwards the application is broken; the only way to make requests to ClickHouse possible again is by restarting the JVM.
Repeatedly sending 16 or fewer requests does not exhibit the hanging requests.
Steps to reproduce
- Follow the instructions in https://github.com/devurandom/clickhouse-timeout-mwe to run the sample application.
- Observe that everything works fine when spawning 16 or less requests, or when passing a value greater than 0 as
MAX_THREADS_PER_CLIENT
. - Observe that the application hangs and all requests to ClickHouse throw
java.util.concurrent.TimeoutException
when spawning 17 or more requests while passingMAX_THREADS_PER_CLIENT
as 0.
Expected behaviour
ClickHouse Java HTTP client works, regardless of how many requests I tell it to make at the same time.
Code example
See https://github.com/devurandom/clickhouse-timeout-mwe.
Configuration
Environment
- Client version: ClickHouse HTTP Client 0.6.2, using the built-in Java HTTP Client
- Language version: Java 11, Clojure 1.11.3
- OS: Linux 6.9
ClickHouse server
- ClickHouse Server version: ClickHouse Cloud
- ClickHouse Server non-default settings, if any: ClickHouse Cloud
CREATE TABLE
statements for tables involved: Reproduction works without any tables
Metadata
Metadata
Assignees
Labels
client-api-v2investigatingInvestigation of a root cause is on goingInvestigation of a root cause is on goingv2-feedback