clickhouse-java icon indicating copy to clipboard operation
clickhouse-java copied to clipboard

[Client] Worker thread doesn't catch all exceptions and fails silently

Open chernser opened this issue 10 months ago • 0 comments

Describe the bug

Precondition: async option is enabled. When request is executed there is a worker thread that calls actual client and sends out data while calling thread returns with future to an application code (see com.clickhouse.client.AbstractClient#execute).

Here is worker function:

 return CompletableFuture.supplyAsync(() -> {
                try {
                    return sendAsync(sealedRequest, args);
                } catch (ClickHouseException | IOException e) {
                    throw new CompletionException(ClickHouseException.of(e, sealedRequest.getServer()));
                }
            }, getExecutor());

If any RuntimeException that is not derived from ClickHouseException or IOException (for example IllegalArgumentException) than it will not cause Future to fail.

chernser avatar Apr 24 '24 06:04 chernser