Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query with same id is already running #208

Open
mittalsuraj18 opened this issue Nov 30, 2023 · 8 comments
Open

Query with same id is already running #208

mittalsuraj18 opened this issue Nov 30, 2023 · 8 comments
Labels
blocked-by-jdbc bug Something isn't working

Comments

@mittalsuraj18
Copy link

mittalsuraj18 commented Nov 30, 2023

Describe the bug

We are sometimes seeing this error when loading charts on metabase via clickhouse.
The error message is this

{"database_id":6,"started_at":"2023-10-04T14:28:57.262258Z","via":[{"status":"failed","class":"class clojure.lang.ExceptionInfo","error":"Error executing query: Code: 216. DB::Exception: Query with id = d0afc45c-1970-488b-b935-a2fb48e271d4 is already running. (QUERY_WITH_SAME_ID_IS_ALREADY_RUNNING) (version 22.8.13.20 (official build))\n, server ClickHouseNode [uri=https://<MASKED_HOST>:8443/default, options={connect_timeout=900000,socket_timeout=900000,dataTransferTimeout=900000,use_server_time_zone_for_dates=true,use_no_proxy=false,product_name=metabase/1.1.2}]@1823720274","stacktrace":["--> driver.sql_jdbc.execute$execute_reducible_query$fn__71852.invoke(execute.clj:505)","driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:502)","driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:489)","driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:497)","driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:489)","driver.sql_jdbc$fn__105186.invokeStatic(sql_jdbc.clj:63)","driver.sql_jdbc$fn__105186.invoke(sql_jdbc.clj:61)","query_processor.context$executef.invokeStatic(context.clj:60)","query_processor.context$executef.invoke(context.clj:49)"

Steps to reproduce

  1. Have a metabase dashboard with a lot of charts connected to clickhouse.
  2. Query these metabase charts via API / via UI. Sometimes in succession.

Expected behaviour

Query should succeed.

Environment

  • metabase-clickhouse-driver version:
  • metabase-clickhouse-driver configuration:
  • Metabase version:
  • OS:

ClickHouse server

  • ClickHouse Server version: 22.8.13.20
  • ClickHouse Server non-default settings, if any: None
  • CREATE TABLE statements for tables involved:
  • Sample data for all these tables, use clickhouse-obfuscator if necessary
@mittalsuraj18 mittalsuraj18 added the bug Something isn't working label Nov 30, 2023
@slvrtrn
Copy link
Collaborator

slvrtrn commented Dec 1, 2023

Have a metabase dashboard with a lot of charts connected to clickhouse.
Query these metabase charts via API / via UI. Sometimes in succession.

Can you please provide a more concrete scenario here?

@mittalsuraj18
Copy link
Author

mittalsuraj18 commented Dec 1, 2023

@slvrtrn So, the queries are long running queries. Some of them take more than 60 seconds to run.
Basically have a metabase dashboard with long running queries.
And open those dashboard in quick succession before the first query finishes.
Or, query the metabase questions API for the same dashboard multiple times at once.

@Stasik371
Copy link

@slvrtrn Hello! I encountered the same problem while executing query: OPTIMIZE TABLE X PARTITION P FINAL DEDUPLICATE on the last 3 partitions. The number of records in them varies from 7 to 9 million. On average, one partition weighs 700 MB. Do u have some ideas, what could be causing this error? The workload for Clickhouse seems manageable. Table engine: ReplicatedReplasingMergeTree

@slvrtrn
Copy link
Collaborator

slvrtrn commented Jan 18, 2024

@mzitnik, tagging you cause I think we need you here as you have more knowledge about the JDBC driver internals.

@mzitnik
Copy link

mzitnik commented Jan 30, 2024

Do we get a timeout from the driver?
Is the query on the server finished? (We can see it in query_log)

@Stasik371
Copy link

Stasik371 commented Jan 30, 2024

hi!I think this might answer your questions. Green rectangles are successful requests, red rectangles are the opposite.
image

@jack-reso
Copy link

i also have this problem.
when i running a long time sql question,it's come out error every time at 10min.
where can i change my config?

@chernser
Copy link

Good day,
there is a similar issue for java client ClickHouse/clickhouse-java#1529
I believe root cause is in multithreaded access. I have a tests that reproduces the problem. However fix would require some refactoring that will take time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked-by-jdbc bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants