Repository navigation
Closed
Labels
Description
Important: This issue was automatically generated and is used by CI for matching failures. DO NOT modify the body content. DO NOT remove labels.
Test name: 00909_kill_not_initialized_query
Failure reason: return code
CI report: Stateless tests (amd_asan_ubsan, distributed plan, parallel, 1/2)
Failing test history: cidb
Test output:
2026-04-16 18:14:07 Reason: return code: 159
2026-04-16 18:14:07 /home/ubuntu/actions-runner/_work/ClickHouse/ClickHouse/tests/queries/0_stateless/test_puiwup5c/00909_kill_not_initialized_query.sh.debuglog:
2026-04-16 18:14:07 + [2026-04-16 18:04:57] [:10] /home/ubuntu/actions-runner/_work/ClickHouse/ClickHouse/ci/tmp/clickhouse-client --send_logs_level=warning --database=test_puiwup5c --log_comment 00909_kill_not_initialized_query.sh-test_puiwup5c --max_insert_threads 3 --group_by_two_level_threshold 1000000 --group_by_two_level_threshold_bytes 1 --distributed_aggregation_memory_efficient 1 --fsync_metadata 1 --output_format_parallel_formatting 0 --input_format_parallel_parsing 0 --min_chunk_bytes_for_parallel_parsing 9765129 --max_read_buffer_size 591418 --prefer_localhost_replica 0 --max_block_size 11823 --max_joined_block_size_rows 80706 --joined_block_split_single_row 1 --join_output_by_rowlist_perkey_rows_threshold 377 --max_threads 1 --optimize_append_index 0 --use_hedged_requests 1 --optimize_if_chain_to_multiif 0 --optimize_if_transform_strings_to_enum 0 --optimize_read_in_order 1 --optimize_or_like_chain 0 --optimize_substitute_columns 0 --enable_multiple_prewhere_read_steps 0 --read_in_order_two_level_merge_threshold 70 --optimize_aggregation_in_order 0 --aggregation_in_order_max_block_bytes 20707517 --use_uncompressed_cache 1 --min_bytes_to_use_direct_io 111229928 --min_bytes_to_use_mmap_io 10737418240 --local_filesystem_read_method mmap --remote_filesystem_read_method threadpool --local_filesystem_read_prefetch 1 --filesystem_cache_segments_batch_size 5 --read_from_filesystem_cache_if_exists_otherwise_bypass_cache 1 --throw_on_error_from_cache_on_write_operations 1 --remote_filesystem_read_prefetch 1 --distributed_cache_discard_connection_if_unread_data 0 --distributed_cache_use_clients_cache_for_write 0 --distributed_cache_use_clients_cache_for_read 1 --allow_prefetched_read_pool_for_remote_filesystem 1 --filesystem_prefetch_max_memory_usage 128Mi --filesystem_prefetches_limit 10 --filesystem_prefetch_min_bytes_for_single_read_task 16Mi --filesystem_prefetch_step_marks 0 --filesystem_prefetch_step_bytes 0 --enable_filesystem_cache 1 --enable_filesystem_cache_on_write_operations 0 --compile_expressions 1 --compile_aggregate_expressions 0 --compile_sort_description 0 --merge_tree_coarse_index_granularity 15 --optimize_distinct_in_order 0 --max_bytes_before_remerge_sort 28286003 --min_compress_block_size 2210122 --max_compress_block_size 1460701 --merge_tree_compact_parts_min_granules_to_multibuffer_read 33 --optimize_sorting_by_input_stream_properties 0 --http_response_buffer_size 85081 --http_wait_end_of_query False --enable_memory_bound_merging_of_aggregation_results 1 --min_count_to_compile_expression 0 --min_count_to_compile_aggregate_expression 3 --min_count_to_compile_sort_description 3 --session_timezone America/Hermosillo --use_page_cache_for_disks_without_file_cache True --use_page_cache_for_local_disks False --use_page_cache_for_object_storage True --page_cache_inject_eviction False --merge_tree_read_split_ranges_into_intersecting_and_non_intersecting_injection_probability 0.44 --prefer_external_sort_block_bytes 1 --cross_join_min_rows_to_compress 1 --cross_join_min_bytes_to_compress 100000000 --min_external_table_block_size_bytes 100000000 --max_parsing_threads 1 --optimize_functions_to_subcolumns 1 --parallel_replicas_local_plan 0 --query_plan_join_swap_table false --enable_vertical_final 1 --optimize_extract_common_expressions 1 --optimize_rewrite_array_exists_to_has True --optimize_skip_unused_shards True --optimize_trivial_approximate_count_query False --optimize_trivial_insert_select True --optimize_using_constraints True --optimize_syntax_fuse_functions True --optimize_aggregators_of_group_by_keys True --optimize_and_compare_chain True --optimize_arithmetic_operations_in_aggregate_functions True --optimize_count_from_files True --optimize_distributed_group_by_sharding_key True --optimize_empty_string_comparisons True --optimize_group_by_constant_keys True --optimize_group_by_function_keys True --optimize_injective_functions_in_group_by True --optimize_injective_functions_inside_uniq True --optimize_inverse_dictionary_lookup True --optimize_move_to_prewhere True --optimize_multiif_to_if False --optimize_normalize_count_variants False --optimize_on_insert True --optimize_redundant_functions_in_order_by True --optimize_respect_aliases False --optimize_rewrite_aggregate_function_with_if True --optimize_rewrite_regexp_functions True --optimize_rewrite_sum_if_to_count_if True --optimize_skip_unused_shards_rewrite_in True --optimize_time_filter_with_preimage True --optimize_trivial_count_query True --optimize_uniq_to_count True --optimize_use_projections True --optimize_use_implicit_projections True --optimize_use_projection_filtering True --query_plan_optimize_lazy_materialization True --query_plan_optimize_prewhere True --use_async_executor_for_materialized_views 1 --use_query_condition_cache 0 --secondary_indices_enable_bulk_filtering 1 --use_skip_indexes_if_final 0 --use_skip_indexes_on_data_read 1 --optimize_rewrite_like_perfect_affix 1 --input_format_parquet_use_native_reader_v3 0 --enable_lazy_columns_replication 1 --allow_special_serialization_kinds_in_output_formats 1 --use_skip_indexes_for_top_k 1 --use_top_k_dynamic_filtering 0 --query_plan_max_limit_for_top_k_optimization 10 --query_plan_read_in_order_through_join 0 --read_in_order_use_virtual_row 0 --short_circuit_function_evaluation_for_nulls_threshold 0.9143096614885934 --automatic_parallel_replicas_mode 0 --temporary_files_buffer_size 1027250 --query_plan_optimize_join_order_algorithm greedy --execute_exists_as_scalar_subquery True --normalize_function_names True --enable_join_runtime_filters True --enable_parallel_blocks_marshalling True --query_plan_reuse_storage_ordering_for_window_functions False --query_plan_join_shard_by_pk_ranges True --count_distinct_optimization False --enable_add_distinct_to_in_subqueries True --use_statistics True --use_statistics_cache True --enable_optimize_predicate_expression True --enable_optimize_predicate_expression_to_final_subquery True --enable_software_prefetch_in_aggregation True --allow_reorder_prewhere_conditions True --query_plan_merge_filters True --query_plan_remove_unused_columns True --query_plan_convert_outer_join_to_inner_join True --query_plan_convert_any_join_to_semi_or_anti_join True --query_plan_merge_filter_into_join_condition True --query_plan_enable_multithreading_after_window_functions True --query_plan_max_limit_for_lazy_materialization 1 --query_plan_optimize_join_order_limit 1 --max_bytes_before_external_sort 0 --max_bytes_before_external_group_by 10737418240 --max_bytes_ratio_before_external_sort 0 --max_bytes_ratio_before_external_group_by 0 --use_skip_indexes_if_final_exact_mode 0 --allow_merge_tree_settings --ratio_of_defaults_for_sparse_serialization 1.0 --prefer_fetch_merged_part_size_threshold 10737418240 --vertical_merge_algorithm_min_rows_to_activate 1 --vertical_merge_algorithm_min_columns_to_activate 100 --allow_vertical_merges_from_compact_to_wide_parts 1 --min_merge_bytes_to_use_direct_io 10737418240 --index_granularity_bytes 2623992 --merge_max_block_size 4768 --index_granularity 15448 --min_bytes_for_wide_part 0 --marks_compress_block_size 32010 --primary_key_compress_block_size 52223 --replace_long_file_name_to_hash 0 --max_file_name_length 128 --min_bytes_for_full_part_storage 173037121 --compact_parts_max_bytes_to_buffer 258102016 --compact_parts_max_granules_to_buffer 256 --compact_parts_merge_max_bytes_to_prefetch_part 8868560 --cache_populated_by_fetch 1 --concurrent_part_removal_threshold 100 --old_parts_lifetime 212 --prewarm_mark_cache 0 --use_const_adaptive_granularity 1 --enable_index_granularity_compression 1 --enable_block_number_column 1 --enable_block_offset_column 1 --use_primary_key_cache 1 --prewarm_primary_key_cache 0 --object_serialization_version v2 --object_shared_data_serialization_version advanced --object_shared_data_serialization_version_for_zero_level_parts map_with_buckets --object_shared_data_buckets_for_compact_part 27 --object_shared_data_buckets_for_wide_part 20 --dynamic_serialization_version v2 --serialization_info_version basic --string_serialization_version with_size_stream --nullable_serialization_version allow_sparse --enable_shared_storage_snapshot_in_query 1 --min_columns_to_activate_adaptive_write_buffer 647 --reduce_blocking_parts_sleep_ms 437 --shared_merge_tree_outdated_parts_group_size 2 --shared_merge_tree_max_outdated_parts_to_process_at_once 2 --map_serialization_version basic --map_serialization_version_for_zero_level_parts basic --max_buckets_in_map 45 --map_buckets_strategy linear --map_buckets_min_avg_size 62 --compress_per_column_in_compact_parts 0 --allow_repeated_settings --allow_repeated_settings --client_logs_file=/home/ubuntu/actions-runner/_work/ClickHouse/ClickHouse/tests/queries/0_stateless/00909_kill_not_initialized_query.5139.stderr-fatal -q 'DROP TABLE IF EXISTS cannot_kill_query'
2026-04-16 18:14:07 + [2026-04-16 18:04:59] [:11] /home/ubuntu/actions-runner/_work/ClickHouse/ClickHouse/ci/tmp/clickhouse-client --send_logs_level=warning --database=test_puiwup5c --log_comment 00909_kill_not_initialized_query.sh-test_puiwup5c --max_insert_threads 3 --group_by_two_level_threshold 1000000 --group_by_two_level_threshold_bytes 1 --distributed_aggregation_memory_efficient 1 --fsync_metadata 1 --output_format_parallel_formatting 0 --input_format_parallel_parsing 0 --min_chunk_bytes_for_parallel_parsing 9765129 --max_read_buffer_size 591418 --prefer_localhost_replica 0 --max_block_size 11823 --max_joined_block_size_rows 80706 --joined_block_split_single_row 1 --join_output_by_rowlist_perkey_rows_threshold 377 --max_threads 1 --optimize_append_index 0 --use_hedged_requests 1 --optimize_if_chain_to_multiif 0 --optimize_if_transform_strings_to_enum 0 --optimize_read_in_order 1 --optimize_or_like_chain 0 --optimize_substitute_columns 0 --enable_multiple_prewhere_read_steps 0 --read_in_order_two_level_merge_threshold 70 --optimize_aggregation_in_order 0 --aggregation_in_order_max_block_bytes 20707517 --use_uncompressed_cache 1 --min_bytes_to_use_direct_io 111229928 --min_bytes_to_use_mmap_io 10737418240 --local_filesystem_read_method mmap --remote_filesystem_read_method threadpool --local_filesystem_read_prefetch 1 --filesystem_cache_segments_batch_size 5 --read_from_filesystem_cache_if_exists_otherwise_bypass_cache 1 --throw_on_error_from_cache_on_write_operations 1 --remote_filesystem_read_prefetch 1 --distributed_cache_discard_connection_if_unread_data 0 --distributed_cache_use_clients_cache_for_write 0 --distributed_cache_use_clients_cache_for_read 1 --allow_prefetched_read_pool_for_remote_filesystem 1 --filesystem_prefetch_max_memory_usage 128Mi --filesystem_prefetches_limit 10 --filesystem_prefetch_min_bytes_for_single_read_task 16Mi --filesystem_prefetch_step_marks 0 --filesystem_prefetch_step_bytes 0 --enable_filesystem_cache 1 --enable_filesystem_cache_on_write_operations 0 --compile_expressions 1 --compile_aggregate_expressions 0 --compile_sort_description 0 --merge_tree_coarse_index_granularity 15 --optimize_distinct_in_order 0 --max_bytes_before_remerge_sort 28286003 --min_compress_block_size 2210122 --max_compress_block_size 1460701 --merge_tree_compact_parts_min_granules_to_multibuffer_read 33 --optimize_sorting_by_input_stream_properties 0 --http_response_buffer_size 85081 --http_wait_end_of_query False --enable_memory_bound_merging_of_aggregation_results 1 --min_count_to_compile_expression 0 --min_count_to_compile_aggregate_expression 3 --min_count_to_compile_sort_description 3 --session_timezone America/Hermosillo --use_page_cache_for_disks_without_file_cache True --use_page_cache_for_local_disks False --use_page_cache_for_object_storage True --page_cache_inject_eviction False --merge_tree_read_split_ranges_into_intersecting_and_non_intersecting_injection_probability 0.44 --prefer_external_sort_block_bytes 1 --cross_join_min_rows_to_compress 1 --cross_join_min_bytes_to_compress 100000000 --min_external_table_block_size_bytes 100000000 --max_parsing_threads 1 --optimize_functions_to_subcolumns 1 --parallel_replicas_local_plan 0 --query_plan_join_swap_table false --enable_vertical_final 1 --optimize_extract_common_expressions 1 --optimize_rewrite_array_exists_to_has True --optimize_skip_unused_shards True --optimize_trivial_approximate_count_query False --optimize_trivial_insert_select True --optimize_using_constraints True --optimize_syntax_fuse_functions True --optimize_aggregators_of_group_by_keys True --optimize_and_compare_chain True --optimize_arithmetic_operations_in_aggregate_functions True --optimize_count_from_files True --optimize_distributed_group_by_sharding_key True --optimize_empty_string_comparisons True --optimize_group_by_constant_keys True --optimize_group_by_function_keys True --optimize_injective_functions_in_group_by True --optimize_injective_functions_inside_uniq True --optimize_inverse_dictionary_lookup True --optimize_move_to_prewhere True --optimize_multiif_to_if False --optimize_normalize_count_variants False --optimize_on_insert True --optimize_redundant_functions_in_order_by True --optimize_respect_aliases False --optimize_rewrite_aggregate_function_with_if True --optimize_rewrite_regexp_functions True --optimize_rewrite_sum_if_to_count_if True --optimize_skip_unused_shards_rewrite_in True --optimize_time_filter_with_preimage True --optimize_trivial_count_query True --optimize_uniq_to_count True --optimize_use_projections True --optimize_use_implicit_projections True --optimize_use_projection_filtering True --query_plan_optimize_lazy_materialization True --query_plan_optimize_prewhere True --use_async_executor_for_materialized_views 1 --use_query_condition_cache 0 --secondary_indices_enable_bulk_filtering 1 --use_skip_indexes_if_final 0 --use_skip_indexes_on_data_read 1 --optimize_rewrite_like_perfect_affix 1 --input_format_parquet_use_native_reader_v3 0 --enable_lazy_columns_replication 1 --allow_special_serialization_kinds_in_output_formats 1 --use_skip_indexes_for_top_k 1 --use_top_k_dynamic_filtering 0 --query_plan_max_limit_for_top_k_optimization 10 --query_plan_read_in_order_through_join 0 --read_in_order_use_virtual_row 0 --short_circuit_function_evaluation_for_nulls_threshold 0.9143096614885934 --automatic_parallel_replicas_mode 0 --temporary_files_buffer_size 1027250 --query_plan_optimize_join_order_algorithm greedy --execute_exists_as_scalar_subquery True --normalize_function_names True --enable_join_runtime_filters True --enable_parallel_blocks_marshalling True --query_plan_reuse_storage_ordering_for_window_functions False --query_plan_join_shard_by_pk_ranges True --count_distinct_optimization False --enable_add_distinct_to_in_subqueries True --use_statistics True --use_statistics_cache True --enable_optimize_predicate_expression True --enable_optimize_predicate_expression_to_final_subquery True --enable_software_prefetch_in_aggregation True --allow_reorder_prewhere_conditions True --query_plan_merge_filters True --query_plan_remove_unused_columns True --query_plan_convert_outer_join_to_inner_join True --query_plan_convert_any_join_to_semi_or_anti_join True --query_plan_merge_filter_into_join_condition True --query_plan_enable_multithreading_after_window_functions True --query_plan_max_limit_for_lazy_materialization 1 --query_plan_optimize_join_order_limit 1 --max_bytes_before_external_sort 0 --max_bytes_before_external_group_by 10737418240 --max_bytes_ratio_before_external_sort 0 --max_bytes_ratio_before_external_group_by 0 --use_skip_indexes_if_final_exact_mode 0 --allow_merge_tree_settings --ratio_of_defaults_for_sparse_serialization 1.0 --prefer_fetch_merged_part_size_threshold 10737418240 --vertical_merge_algorithm_min_rows_to_activate 1 --vertical_merge_algorithm_min_columns_to_activate 100 --allow_vertical_merges_from_compact_to_wide_parts 1 --min_merge_bytes_to_use_direct_io 10737418240 --index_granularity_bytes 2623992 --merge_max_block_size 4768 --index_granularity 15448 --min_bytes_for_wide_part 0 --marks_compress_block_size 32010 --primary_key_compress_block_size 52223 --replace_long_file_name_to_hash 0 --max_file_name_length 128 --min_bytes_for_full_part_storage 173037121 --compact_parts_max_
Version info
- Resolved by: Try to fix flaky test 00909_kill_not_initialized_query #102994
- Merged into:
26.5.1.577
Activity
groeneai commentedon Jul 27, 2026
00909_kill_not_initialized_queryis still failing after #102994, and while diagnosing it I found that the test no longer asserts what its name claims. The flakiness has a clean root cause and a clean fix, but repairing the test's actual coverage needs an owner decision, so I am posting the analysis instead of opening a PR.The flakiness
Signature:
result differs with reference: @@ -1 +0,0 @@ -killed(stdout empty). Three occurrences in the last 30 days, all onStateless tests (amd_tsan, s3 storage, parallel, 2/3), durations 174 s / 224 s / 254 s against a median of 13.7 s over 128378 passing runs. Latest: PR 109524 report. No master failures in 180 days.(The other six CIDB rows for this test are unrelated: five are
return code: 241with(total) memory limit exceeded ... current RSS: 41.85 GiB, maximum: 41.84 GiB, all inside one 11-hour window on 2026-07-15, and one isreturn code: 210 Connection reset by peer.)The cause is that the test sequences background queries with blind
sleep 1, andKILL QUERYresolves its victim set exactly once. From that job's ownquery_log.tsv.zst, databasetest_hd2dn6zu:The target registered in
ProcessList152 ms after the KILL had already finished, so the KILL matched nothing and the query ran to completion.ProcessList::inserthappens atexecuteQuery.cpp:1574, after connect, handshake, send, parse andcheckASTSizeLimits; measured spawn-to-registration here was about 3.5 s, against the test's 1 s budget.InterpreterKillQueryQuery::executetakes one snapshot at:221and returns early on:222-223if it is empty, andSyncKillQuerySourceonly re-polls victims already inprocesses_to_stop, so SYNC does not help either. A passing rerun in the same job (databasetest_guf9uj1o) cancelled in 60 ms, which is why the runner's same-settings reruns pass 4/4.Two smaller issues in the same test: both KILL predicates and the final poll match on query text with no
current_databasescope, so concurrent copies can interfere (00417_kill_query.shalready guards this); and the final loop only allows 15 seconds.The fix for all of this is mechanical and follows the existing idiom (
wait_for_query_to_startinshell_config.sh:180, as used by02932_kill_query_sleep.shand others): give each background query a--query_id, wait for it to appear insystem.processes, and KILL byquery_idpluscurrent_database = currentDatabase().Why I did not just send that PR
That change would make the test reliable, but the test currently has no content to protect:
ALTER TABLE cannot_kill_query MODIFY COLUMN x UInt64is a same-type no-op that finishes in 111-152 ms in every failing trace, so it never blocks anything. The comment "blocked queries can be killed with ASYNC kill" no longer describes what runs.CancellationCode::QueryIsNotInitializedYet(CancellationCode.h:10) has no producer anywhere insrc/.grep -rn QueryIsNotInitializedYet src/returns the enum declaration and two consumers inInterpreterKillQueryQuery.cpp(:53,:173). The state the test is named after is unreachable.So what it actually exercises today is "a long-running SELECT can be killed", which
02932_kill_query_sleep.shand04003_cancel_scalar_subquery.shalready cover. Stabilising it without restoring the scenario would turn a flaky signal into a permanently green no-op, which seems worse than leaving it flaky.I then tried to restore a real blocked query and could not do it from SQL. A SELECT parked on
lockForSharewould be the right scenario, sinceProcessList::insert(:1574) precedes interpretation (:1834), so such a query is registered but not yet executing. But there is no non-destructive way to hold that lock:ALTERcannot block a SELECT at all.InterpreterAlterQuery.cpp:477takeslockForShare(a reader), and:317takeslockForAlter, which is a separatestd::timed_mutex alter_lock(IStorage.h:789-791) that no SELECT path touches.lockExclusivelycall sites,DETACHandDROPonly lock whendatabase->getUUID() == UUIDHelpers::Nil(InterpreterDropQuery.cpp:302-303,:360-361), which is false for Atomic;TRUNCATEskips the lock for MergeTree (:331-333); the rest are RENAME onDatabaseOnDisk,DatabaseMySQL, andSYSTEM RESTART REPLICA.SYSTEM RESTART REPLICAand OrdinaryDETACHwould poison the waiting reader rather than park it:is_being_restarted = trueis set atInterpreterSystemQuery.cpp:1429before the exclusive lock at:1441, andlockForSharethrowsTABLE_IS_BEING_RESTARTED/TABLE_IS_DROPPED(IStorage.cpp:69-75). The reader would then fail for a reason unrelated toKILL QUERY, so the test would pass for the wrong reason.There is also no deterministic rendezvous available:
RWLockImpl::getLockwaits on a condition variable with no cancellation check, and there is no failpoint on the query-start or lock-acquisition path (grep fiu_do_oninIStorage.cpp,RWLock.cpp,Analyzer/TableNode.cppreturns nothing). Waiting for the query to appear insystem.processesis not sufficient either, since that returns before the interpreter runs, so the reader could still win the lock.The decision I would like
Two options, neither of which I think I should pick unilaterally:
00909. Its scenario is unreachable and its remaining coverage is duplicated elsewhere. This removes a test, so it needs a maintainer's call.SYSTEM ENABLE FAILPOINT/SYSTEM WAIT FAILPOINT ... PAUSE(the shape03984_truncate_database_sync_cancellation.shuses) and assertexception_code = 394. That means adding a hook to a core concurrency path for one test, so where it belongs, and whether it is wanted at all, is also a maintainer's call.If option 1 is preferred I am happy to send the deletion. If option 2 is preferred, I would like guidance on where the hook should live before writing it. I can also send the
query_idandcurrent_databasecleanup on its own as an interim measure if you would rather keep the test green while the larger question is decided, though on its own it would only be hiding the fact that the test asserts nothing.