Skip to content

Fix flaky 03309_json_with_progress_exception: timeout in pending state - #111208

Merged
Algunenano merged 1 commit into
ClickHouse:masterfrom
Algunenano:fix-timeout-pending-state-error-code
Jul 24, 2026
Merged

Algunenano merged 1 commit into
ClickHouse:masterfrom
Algunenano:fix-timeout-pending-state-error-code

Conversation

@Algunenano

@Algunenano Algunenano commented Jul 21, 2026 •

Copy link
Copy Markdown
Member

When max_execution_time fires while a query is still pending (being analyzed/planned, before any executor starts), the client now gets TIMEOUT_EXCEEDED instead of a generic QUERY_WAS_CANCELLED "killed in pending state", matching the error it would get had the deadline fired during execution. Under load this was making 03309_json_with_progress_exception flaky, because the query occasionally spends more than a second in planning and the deadline fires before execution begins.

Closes: #111198

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Version info

  • Merged into: 26.8.1.75 (included in 26.8 and later)

When max_execution_time fired while a query was still pending (being
analyzed/planned, before any executor started), the pending-state check
in executeQuery threw QUERY_WAS_CANCELLED ("killed in pending state")
regardless of the cancel reason, instead of TIMEOUT_EXCEEDED. Under load
this made 03309_json_with_progress_exception flaky.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [5843b0e]

Summary: ✅


AI Review

Summary

This PR fixes the pending-state timeout path in executeQuery so queries whose max_execution_time expires during analysis/planning now surface TIMEOUT_EXCEEDED instead of the generic pending-state QUERY_WAS_CANCELLED. I did not find a correctness issue in the code change itself; the remaining concern is that the PR metadata classifies a user-visible server bug fix as a CI-only change.

PR Metadata

Changelog category is not semantically correct for the actual change. CI Fix or Improvement is reserved for CI-only work, but this patch changes the server's user-visible error contract in a stable code path. This should use Bug Fix.

Changelog entry becomes required once the category is corrected and should describe the visible behavior change. Suggested replacement:

Queries whose max_execution_time expires before execution starts now return TIMEOUT_EXCEEDED instead of QUERY_WAS_CANCELLED.

Findings

💡 Nits

  • src/Interpreters/executeQuery.cpp:1950 This is a real user-visible bug fix, so the PR should not use the CI Fix or Improvement category. Switch to Bug Fix and add a changelog entry describing the timeout/error-code change.
Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 21, 2026
Comment thread src/Interpreters/executeQuery.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 48.20% 86.20% +38.00%
Functions 56.90% 92.00% +35.10%
Branches 36.60% 78.30% +41.70%

Changed lines: Changed C/C++ lines covered: 6/7 (85.71%) · Uncovered code

Full report · Diff report

@Algunenano
Algunenano added this pull request to the merge queue Jul 24, 2026
Merged via the queue into ClickHouse:master with commit b319878 Jul 24, 2026
524 of 527 checks passed
@Algunenano
Algunenano deleted the fix-timeout-pending-state-error-code branch July 24, 2026 11:05
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 24, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…ing-state-error-code

Fix flaky 03309_json_with_progress_exception: timeout in pending state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: 03309_json_with_progress_exception

2 participants