Closed romubaronvp closed 5 months ago
@romubaronvp, as I understood from your report, it tries to use SSL even when the "Use secure connection (SSL)" toggle is off, right?
This also looks odd:
https://myclickhouse.instance.com:8123/default, options={use_server_time_zone_for_dates=true,use_no_proxy=false,product_name=metabase/1.3.1}
It's HTTPS, but there is no mention of SSL in the params, and I assume, as it is an internal Docker container, there is no HTTPS/SSL at all.
Additionally, what was the last working version (i.e. on which version the existing connections were created?)
I will have a look anyway.
Hey Serge,
Indeed, the "Use secure connection (SSL)" toggle is off. That's why I felt it to be weird. With of without SSL being activated, it raised the exact same error, it's like the SSL was set as on by default and wasn't taking into account the toggle value.
I don't recall the last time I added a clickhouse DB but I would think that it was with 1.2.1
I'm currently trying with those version, I'll get you back once tested.
Moving back to 1.2.5 allowed me to add the database.
i have a similiar question. my password contain '@', so i can't connect to clickhouse. however when i use account which password only contain 0-9a-zA-Z,it can success connect.
@slvrtrn
1.2.1 works when my password contains '@',so i roll back
@jack-reso, thanks. I will check it with complex passwords. But overall, this is odd, as there were no changes to the underlying driver; needs some investigation.
@romubaronvp, does it behave the same in your scenario, too?
the same problem, and there is no '@' in my password 1.2.5 works for me
java.sql.SQLException: SSL peer shut down incorrectly, server ClickHouseNode [uri={myck}, options={use_server_time_zone_for_dates=true,use_no_proxy=false,product_name=metabase/1.3.1}]@-564653228
at com.clickhouse.jdbc.SqlExceptionUtils.handle(SqlExceptionUtils.java:85)
at com.clickhouse.jdbc.SqlExceptionUtils.create(SqlExceptionUtils.java:31)
at com.clickhouse.jdbc.SqlExceptionUtils.handle(SqlExceptionUtils.java:90)
at com.clickhouse.jdbc.internal.ClickHouseConnectionImpl.getServerInfo(ClickHouseConnectionImpl.java:131)
at com.clickhouse.jdbc.internal.ClickHouseConnectionImpl.<init>(ClickHouseConnectionImpl.java:335)
at com.clickhouse.jdbc.internal.ClickHouseConnectionImpl.<init>(ClickHouseConnectionImpl.java:288)
at com.clickhouse.jdbc.ClickHouseDriver.connect(ClickHouseDriver.java:157)
at com.clickhouse.jdbc.ClickHouseDriver.connect(ClickHouseDriver.java:41)
at metabase.plugins.jdbc_proxy$proxy_driver$reify__88176.connect(jdbc_proxy.clj:37)
at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
at clojure.java.jdbc$get_driver_connection.invokeStatic(jdbc.clj:271)
at clojure.java.jdbc$get_driver_connection.invoke(jdbc.clj:250)
at clojure.java.jdbc$get_connection.invokeStatic(jdbc.clj:411)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:274)
at clojure.java.jdbc$get_connection.invokeStatic(jdbc.clj:343)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:274)
at metabase.driver.sql_jdbc.execute$fn__80833$_AMPERSAND_f$reify__80837.getConnection(execute.clj:277)
at metabase.driver.sql_jdbc.execute$fn__80851$_AMPERSAND_f__80852.invoke(execute.clj:333)
at metabase.driver.sql_jdbc.execute$fn__80851$fn__80855.invoke(execute.clj:317)
at metabase.driver.sql_jdbc.execute$fn__80886.invokeStatic(execute.clj:382)
at metabase.driver.sql_jdbc.execute$fn__80886.invoke(execute.clj:380)
at clojure.lang.MultiFn.invoke(MultiFn.java:244)
at metabase.driver.clickhouse$fn__109752.invokeStatic(clickhouse.clj:67)
at metabase.driver.clickhouse$fn__109752.invoke(clickhouse.clj:61)
at clojure.lang.MultiFn.invoke(MultiFn.java:234)
at metabase.driver.util$can_connect_with_details_QMARK_$fn__58411.invoke(util.clj:147)
at clojure.core$binding_conveyor_fn$fn__5823.invoke(core.clj:2047)
at clojure.lang.AFn.call(AFn.java:18)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at java.base/sun.security.ssl.SSLSocketInputRecord.read(Unknown Source)
at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(Unknown Source)
at java.base/sun.security.ssl.SSLSocketInputRecord.decode(Unknown Source)
at java.base/sun.security.ssl.SSLTransport.decode(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.decode(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
at com.clickhouse.client.http.HttpUrlConnectionImpl.post(HttpUrlConnectionImpl.java:225)
at com.clickhouse.client.http.ClickHouseHttpClient.send(ClickHouseHttpClient.java:124)
at com.clickhouse.client.AbstractClient.execute(AbstractClient.java:280)
at com.clickhouse.client.ClickHouseClientBuilder$Agent.sendOnce(ClickHouseClientBuilder.java:282)
at com.clickhouse.client.ClickHouseClientBuilder$Agent.send(ClickHouseClientBuilder.java:294)
at com.clickhouse.client.ClickHouseClientBuilder$Agent.execute(ClickHouseClientBuilder.java:349)
at com.clickhouse.client.ClickHouseClient.executeAndWait(ClickHouseClient.java:1056)
at com.clickhouse.client.ClickHouseRequest.executeAndWait(ClickHouseRequest.java:2154)
at com.clickhouse.jdbc.internal.ClickHouseConnectionImpl.getServerInfo(ClickHouseConnectionImpl.java:128)
... 29 more
@zero-element @romubaronvp @jack-reso Can you please check if the build from #213 fixes the issue?
Not much more luck when trying to add a new DB from Metabase, I got this from the logs:
2024-01-05 17:12:09,501 ERROR driver.util :: Failed to connect to Database
java.lang.Exception: Failed to connect to Database
at metabase.driver.util$can_connect_with_details_QMARK_$fn__58400.invoke(util.clj:147)
at clojure.core$binding_conveyor_fn$fn__5823.invoke(core.clj:2047)
at clojure.lang.AFn.call(AFn.java:18)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
2024-01-05 17:12:09,502 ERROR api.database :: Cannot connect to Database
clojure.lang.ExceptionInfo: Failed to connect to Database {:message "Failed to connect to Database"}
at metabase.driver.util$can_connect_with_details_QMARK_.invokeStatic(util.clj:164)
at metabase.driver.util$can_connect_with_details_QMARK_.doInvoke(util.clj:135)
at clojure.lang.RestFn.invoke(RestFn.java:442)
at metabase.api.database$test_database_connection.invokeStatic(database.clj:694)
at metabase.api.database$test_database_connection.doInvoke(database.clj:684)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at metabase.api.database$fn__101944$_AMPERSAND_f__101945.invoke(database.clj:748)
at metabase.api.database$fn__101944$fn__101952.invoke(database.clj:728)
at metabase.api.database$fn__101965.invokeStatic(database.clj:770)
at metabase.api.database$fn__101965.invoke(database.clj:752)
at compojure.core$wrap_response$fn__43921.invoke(core.clj:160)
at compojure.core$wrap_route_middleware$fn__43905.invoke(core.clj:132)
at compojure.core$wrap_route_info$fn__43910.invoke(core.clj:139)
at compojure.core$wrap_route_matches$fn__43914.invoke(core.clj:151)
at clojure.lang.Var.invoke(Var.java:393)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933$f__43934$respond_SINGLEQUOTE___43935.invoke(core.clj:197)
at compojure.core$wrap_route_matches$fn__43914.invoke(core.clj:152)
at clojure.lang.Var.invoke(Var.java:393)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933.invoke(core.clj:200)
at metabase.server.middleware.auth$enforce_authentication$fn__97393.invoke(auth.clj:17)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933.invoke(core.clj:200)
at compojure.core$make_context$handler__43961.invoke(core.clj:290)
at compojure.core$make_context$fn__43965.invoke(core.clj:300)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933$f__43934$respond_SINGLEQUOTE___43935.invoke(core.clj:197)
at compojure.core$make_context$fn__43965.invoke(core.clj:301)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933$f__43934$respond_SINGLEQUOTE___43935.invoke(core.clj:197)
at compojure.core$make_context$fn__43965.invoke(core.clj:301)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933$f__43934$respond_SINGLEQUOTE___43935.invoke(core.clj:197)
at compojure.core$make_context$fn__43965.invoke(core.clj:301)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933$f__43934$respond_SINGLEQUOTE___43935.invoke(core.clj:197)
at compojure.core$make_context$fn__43965.invoke(core.clj:301)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933$f__43934$respond_SINGLEQUOTE___43935.invoke(core.clj:197)
at compojure.core$make_context$fn__43965.invoke(core.clj:301)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933$f__43934$respond_SINGLEQUOTE___43935.invoke(core.clj:197)
at compojure.core$make_context$fn__43965.invoke(core.clj:301)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933$f__43934$respond_SINGLEQUOTE___43935.invoke(core.clj:197)
at compojure.core$make_context$fn__43965.invoke(core.clj:301)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933$f__43934$respond_SINGLEQUOTE___43935.invoke(core.clj:197)
at compojure.core$make_context$fn__43965.invoke(core.clj:301)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933$f__43934$respond_SINGLEQUOTE___43935.invoke(core.clj:197)
at metabase.api.routes$fn__105129$fn__105132.invoke(routes.clj:66)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933.invoke(core.clj:200)
at clojure.lang.AFn.applyToHelper(AFn.java:160)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$apply.invoke(core.clj:662)
at metabase.server.routes$fn__105292$fn__105293.doInvoke(routes.clj:72)
at clojure.lang.RestFn.invoke(RestFn.java:436)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933.invoke(core.clj:200)
at compojure.core$make_context$handler__43961.invoke(core.clj:290)
at compojure.core$make_context$fn__43965.invoke(core.clj:300)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933$f__43934$respond_SINGLEQUOTE___43935.invoke(core.clj:197)
at compojure.core$wrap_route_matches$fn__43914.invoke(core.clj:153)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933$f__43934$respond_SINGLEQUOTE___43935.invoke(core.clj:197)
at compojure.core$wrap_route_matches$fn__43914.invoke(core.clj:153)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933$f__43934$respond_SINGLEQUOTE___43935.invoke(core.clj:197)
at compojure.core$wrap_route_matches$fn__43914.invoke(core.clj:153)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933$f__43934$respond_SINGLEQUOTE___43935.invoke(core.clj:197)
at metabase.server.routes$fn__105277$fn__105279.invoke(routes.clj:49)
at compojure.core$routes$fn__43933$f__43934.invoke(core.clj:198)
at compojure.core$routes$fn__43933.invoke(core.clj:200)
at metabase.server.middleware.exceptions$catch_uncaught_exceptions$fn__102187.invoke(exceptions.clj:108)
at metabase.server.middleware.exceptions$catch_api_exceptions$fn__102184.invoke(exceptions.clj:96)
at metabase.server.middleware.log$log_api_call$fn__105558$fn__105559$fn__105560.invoke(log.clj:216)
at metabase.driver.sql_jdbc.execute.diagnostic$do_with_diagnostic_info.invokeStatic(diagnostic.clj:18)
at metabase.driver.sql_jdbc.execute.diagnostic$do_with_diagnostic_info.invoke(diagnostic.clj:12)
at metabase.server.middleware.log$log_api_call$fn__105558$fn__105559.invoke(log.clj:208)
at toucan2.execute$do_with_call_counts.invokeStatic(execute.clj:112)
at toucan2.execute$do_with_call_counts.invoke(execute.clj:103)
at metabase.server.middleware.log$log_api_call$fn__105558.invoke(log.clj:207)
at metabase.server.middleware.browser_cookie$ensure_browser_id_cookie$fn__107591.invoke(browser_cookie.clj:40)
at metabase.server.middleware.security$add_security_headers$fn__88097.invoke(security.clj:180)
at metabase.server.middleware.json$wrap_json_body$fn__45294.invoke(json.clj:67)
at metabase.server.middleware.offset_paging$handle_paging$fn__88121.invoke(offset_paging.clj:45)
at metabase.server.middleware.json$wrap_streamed_json_response$fn__45312.invoke(json.clj:103)
at ring.middleware.keyword_params$wrap_keyword_params$fn__107858.invoke(keyword_params.clj:55)
at ring.middleware.params$wrap_params$fn__107877.invoke(params.clj:77)
at metabase.server.middleware.misc$maybe_set_site_url$fn__68012.invoke(misc.clj:61)
at metabase.server.middleware.session$reset_session_timeout$fn__74264.invoke(session.clj:488)
at metabase.server.middleware.session$bind_current_user$fn__74231$fn__74232.invoke(session.clj:383)
at metabase.server.middleware.session$do_with_current_user.invokeStatic(session.clj:362)
at metabase.server.middleware.session$do_with_current_user.invoke(session.clj:346)
at metabase.server.middleware.session$bind_current_user$fn__74231.invoke(session.clj:382)
at metabase.server.middleware.session$wrap_current_user_info$fn__74214.invoke(session.clj:321)
at metabase.server.middleware.session$wrap_session_id$fn__74197.invoke(session.clj:253)
at metabase.server.middleware.auth$wrap_api_key$fn__97401.invoke(auth.clj:30)
at ring.middleware.cookies$wrap_cookies$fn__107778.invoke(cookies.clj:216)
at metabase.server.middleware.misc$add_content_type$fn__67994.invoke(misc.clj:29)
at metabase.server.middleware.misc$disable_streaming_buffering$fn__68020.invoke(misc.clj:78)
at ring.middleware.gzip$wrap_gzip$fn__107820.invoke(gzip.clj:86)
at metabase.server.middleware.misc$bind_request$fn__68023.invoke(misc.clj:95)
at metabase.server.middleware.ssl$redirect_to_https_middleware$fn__107607.invoke(ssl.clj:51)
at metabase.server$async_proxy_handler$fn__68202.invoke(server.clj:77)
at metabase.server.proxy$org.eclipse.jetty.server.handler.AbstractHandler$ff19274a.handle(Unknown Source)
at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:173)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
at org.eclipse.jetty.server.Server.handle(Server.java:563)
at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.Exception: Failed to connect to Database
at metabase.driver.util$can_connect_with_details_QMARK_$fn__58400.invoke(util.clj:147)
at clojure.core$binding_conveyor_fn$fn__5823.invoke(core.clj:2047)
at clojure.lang.AFn.call(AFn.java:18)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
... 1 more
2024-01-05 17:12:09,504 DEBUG middleware.log :: POST /api/database 400 196.3 ms (0 DB calls)
{:message "Failed to connect to Database"}
@romubaronvp, as I understand, it still doesn't work with the build from the branch? A few questions then:
SHOW DATABASES
queries in the CH query log in this case?Hey :wave:
Not much more luck with this version. I'm unable to add new Clikchouse DB connection, even with "Disable system-wide proxy settings" on or off. For the DB names I have tested, they are all without any capital or spaces. Password are also not containing any special characters.
Hope this helps.
@romubaronvp, I tested multiple scenarios:
ClickHouse versions were between 23.8 and 23.12.
All worked... Which means I am still missing something. Can you please contact me in the community Slack and drop me a line there (see the name in the profile)?
NB: Regarding the SSL exception, that's from Metabase itself: https://github.com/metabase/metabase/blob/v0.48.1/src/metabase/api/database.clj#L728-L734
It always tries to check whether we can have a secure connection even if we choose ssl: false
in the driver configuration, and it will, unfortunately, always produce an exception if SSL is not supported. It does not interfere with the plaintext connection creation, though, as long as the following plaintext connection check passes.
EDIT: here's another build from this branch to try, where I disabled the newly introduced can-connect
override entirely for prod builds. I wonder if this one resolves the issue. Link: clickhouse.metabase-driver.jar.zip
Got the same issue. Metabase: 0.48.2 + 1.3.1 + CH in Docker.
EDIT: here's another build from this branch to try, where I disabled the newly introduced
can-connect
override entirely for prod builds. I wonder if this one resolves the issue. Link: clickhouse.metabase-driver.jar.zip
This build works like a charm!
That's working! No more issue when adding new DB. Thank you guys for your help.
Describe the bug
I've been trying to add a new connection into Metabase using the latest 1.3.1. The error "Failed to connect to Database" is shown.
Existing DB are working as expected but I'm unable to modify them unless I'm also getting the above message as well.
As per the log, it seems that it's always trying to use SSL even if the value is not set to true. I did tried to use additional JDBC connection string without any success.
Error log
Configuration
Environment
ClickHouse server