ClickHouse: Cannot cancel queries when scalar subqueries are being calculated

!!! UPD: if you face that issue - please post the sample of the query in comments after checking if reproduces !!!

Some queries can’t be killed - nor with replace query, nor with kill query.

Sample:


SELECT version()

┌─version()─┐
│ 1.1.54304 │
└───────────┘

1 rows in set. Elapsed: 0.001 sec. 

:) select (SELECT max(number) from system.numbers) + 1;

SELECT 
    (
        SELECT max(number)
        FROM system.numbers 
    ) + 1

^CCancelling query.
^C

> clickhouse-client -m
ClickHouse client version 1.1.54304.
Connecting to localhost:9000.
Connected to ClickHouse server version 1.1.54304.

:) show processlist;

SHOW PROCESSLIST

┌─is_initial_query─┬─user────┬─query_id─────────────────────────────┬─address─┬──port─┬─initial_user─┬─initial_query_id─────────────────────┬─initial_address─┬─initial_port─┬─interface─┬─os_user─┬─client_hostname─┬─client_name───────┬─client_version_major─┬─client_version_minor─┬─client_revision─┬─http_method─┬─http_user_agent─┬─quota_key─┬──────elapsed─┬─read_rows─┬─read_bytes─┬─total_rows_approx─┬─written_rows─┬─written_bytes─┬─memory_usage─┬─query───────────────────────────────────────────────┐
│                1 │ default │ 400f52a9-fa09-42ba-856a-aeb442f56b79 │ ::1     │ 47312 │ default      │ 400f52a9-fa09-42ba-856a-aeb442f56b79 │ ::1             │        47312 │         1 │ name    │ host            │ ClickHouse client │                    1 │                    1 │           54304 │           0 │                 │           │ 18.055088508 │         0 │          0 │                 0 │            0 │             0 │      1052672 │ select (SELECT max(number) from system.numbers) + 1 │
└──────────────────┴─────────┴──────────────────────────────────────┴─────────┴───────┴──────────────┴──────────────────────────────────────┴─────────────────┴──────────────┴───────────┴─────────┴─────────────────┴───────────────────┴──────────────────────┴──────────────────────┴─────────────────┴─────────────┴─────────────────┴───────────┴──────────────┴───────────┴────────────┴───────────────────┴──────────────┴───────────────┴──────────────┴─────────────────────────────────────────────────────┘

(only server restart helps) Also max_execution_time is able to kill that query by timeout.

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 2
  • Comments: 19 (14 by maintainers)

Commits related to this issue

Most upvoted comments

After upgrade to 20.1.2.4 “Immortal” queries appeared. Only server restart helps

Hello everyone! Any news about the new pipeline? Is this in the new LTS 21.3?

This all was one of the motivation to adding the new query pipeline 😃 To allow dynamic pipeline rebuild after execution of scalar subqueries.

Imagine you can build a pipeline that will do only scalar subqueries first - and after they are done, build the main query pipeline.

Still facing same issue in 20.4.3.16

Please post your query

Problem was with mutation. UPDATE was performed on table and later in code this table dropped. This DROP query become immortal.