Skip to content

Give the one-match case of 04650_replace_cancellation a deadline of its own - #113031

Merged
PedroTadim merged 1 commit into
masterfrom
fix-04650-one-match-deadline
Aug 3, 2026
Merged

PedroTadim merged 1 commit into
masterfrom
fix-04650-one-match-deadline

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

04650_replace_cancellation failed on arm_binary about once in a hundred runs, always on the same case:

-one match, long instruction list: stopped within bound
+one match, long instruction list: no timeout

That case builds a single match whose substitution list is executed in full, and every instruction writes another copy of the match, so the work it offers and the memory the result occupies are the same quantity - and how much of it a stopped call has already written grows with the speed of the machine. Against the standard one-second deadline the list therefore had to be short enough for a fast build to stay inside the 5GiB test profile, where it already reached 4GiB, and long enough that a slower build could not finish it, and no single length satisfies both: on a fast enough machine the call completed inside the deadline and the case reported no timeout.

run now takes a deadline per case and keeps the same allowance on top of it rather than the same absolute bound, so shortening a deadline does not loosen the assertion with it. Case 15 takes a tenth of the standard deadline and a list two orders of magnitude longer: the fastest build now has to finish 20GB of copying in 100ms to report no timeout, and what a stopped call has written falls in the same proportion as the deadline.

Measured against the arm_binary and arm_tsan builds of the failing commit, the case goes from 1000ms and 4GiB to 100ms and 390MiB, and on the sanitizer build to 210ms and 50MiB. The whole test passed 8/8 runs on arm_binary and 1/1 on arm_tsan.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=c2c9039413b2e96f64fdbbdecaa23381fb9924df&name_0=MasterCI&name_1=Stateless%20tests%20%28arm_binary%2C%20sequential%29

Related: #112483

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):

...

…ts own

`04650_replace_cancellation` failed on `arm_binary` about once in a hundred
runs, always on the same case:

    -one match, long instruction list: stopped within bound
    +one match, long instruction list: no timeout

That case builds a single match whose substitution list is executed in full, and
every instruction writes another copy of the match, so the work it offers and
the memory the result occupies are the same quantity - and how much of it a
stopped call has already written grows with the speed of the machine. Against
the standard one-second deadline the list therefore had to be short enough for a
fast build to stay inside the 5GiB test profile, where it already reached 4GiB,
and long enough that a slower build could not finish it, and no single length
satisfies both: on a fast enough machine the call completed inside the deadline
and the case reported `no timeout`.

`run` now takes a deadline per case and keeps the same allowance on top of it
rather than the same absolute bound, so shortening a deadline does not loosen
the assertion with it. Case 15 takes a tenth of the standard deadline and a list
two orders of magnitude longer: the fastest build now has to finish 20GB of
copying in 100ms to report `no timeout`, and what a stopped call has written
falls in the same proportion as the deadline. Measured on the `arm_binary` and
`arm_tsan` builds of the failing commit, the case goes from 1000ms and 4GiB to
100ms and 390MiB, and on the sanitizer build to 210ms and 50MiB.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=c2c9039413b2e96f64fdbbdecaa23381fb9924df&name_0=MasterCI&name_1=Stateless%20tests%20%28arm_binary%2C%20sequential%29

Related: #112483
@clickhouse-gh

clickhouse-gh Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [65b8b5f]

Summary: ✅


AI Review

Summary

This PR retunes case 15 in tests/queries/0_stateless/04650_replace_cancellation.sh to use a per-case sub-second max_execution_time and a much larger substitution list, which preserves the test's ability to catch the missing in-function cancellation while cutting the case's peak memory footprint on slower machines. I reviewed the current diff, the surrounding test harness logic, the existing PR discussion/threads, and the current green CI surface for PR #113031, and I did not find a correctness, coverage, or metadata issue that warrants an inline review comment.

Final Verdict

✅ No blocking issues found.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 2, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 65b8b5f32 with master 90042b2dc (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 4b3181f56; compile times per translation unit against the most recent warmup build that recompiled it).

⚠️ Significant changes: object file sizes, slowest function optimization changes (thinlto).

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 685.41 MiB 682.30 MiB -3.11 MiB (-0.45%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Object file sizes ⚠️

285 object files changed (-39.68 MiB total), 1 added, 685 removed.

Object file Master PR Δ
contrib/grpc-cmake/CMakeFiles/grpc_unsecure.dir/__/grpc/src/core/ext/transport/chttp2/transport/cht… 960.56 KiB removed -960.56 KiB (-100.00%)
src/Common/ZooKeeper/CMakeFiles/clickhouse_common_zookeeper_no_log.dir/ZooKeeperImpl.cpp.o 806.39 KiB removed -806.39 KiB (-100.00%)
contrib/grpc-cmake/CMakeFiles/grpc_unsecure.dir/__/grpc/src/core/server/server.cc.o 612.22 KiB removed -612.22 KiB (-100.00%)
contrib/grpc-cmake/CMakeFiles/grpc_unsecure.dir/__/grpc/src/core/load_balancing/rls/rls.cc.o 611.36 KiB removed -611.36 KiB (-100.00%)
contrib/grpc-cmake/CMakeFiles/grpc_unsecure.dir/__/grpc/src/core/client_channel/client_channel_filt… 548.04 KiB removed -548.04 KiB (-100.00%)
contrib/grpc-cmake/CMakeFiles/grpc_unsecure.dir/__/grpc/src/core/client_channel/client_channel.cc.o 525.46 KiB removed -525.46 KiB (-100.00%)
contrib/grpc-cmake/CMakeFiles/grpc_unsecure.dir/__/grpc/src/core/client_channel/retry_interceptor.c… 518.85 KiB removed -518.85 KiB (-100.00%)
contrib/grpc-cmake/CMakeFiles/grpc_unsecure.dir/__/grpc/src/core/lib/channel/promise_based_filter.c… 482.91 KiB removed -482.91 KiB (-100.00%)
contrib/grpc-cmake/CMakeFiles/grpc_unsecure.dir/__/grpc/src/core/load_balancing/grpclb/grpclb.cc.o 434.97 KiB removed -434.97 KiB (-100.00%)
contrib/grpc-cmake/CMakeFiles/grpc_unsecure.dir/__/grpc/src/core/call/client_call.cc.o 433.89 KiB removed -433.89 KiB (-100.00%)
src/CMakeFiles/dbms.dir/Databases/DatabaseURL.cpp.o new 400.85 KiB +400.85 KiB
contrib/grpc-cmake/CMakeFiles/grpc_unsecure.dir/__/grpc/src/core/call/server_call.cc.o 391.29 KiB removed -391.29 KiB (-100.00%)
contrib/grpc-cmake/CMakeFiles/grpc++_unsecure.dir/__/grpc/src/cpp/server/server_cc.cc.o 384.88 KiB removed -384.88 KiB (-100.00%)
contrib/grpc-cmake/CMakeFiles/grpc_unsecure.dir/__/grpc/src/core/client_channel/retry_filter_legacy… 369.55 KiB removed -369.55 KiB (-100.00%)
contrib/grpc-cmake/CMakeFiles/grpc_unsecure.dir/__/grpc/src/core/ext/transport/chttp2/transport/wri… 349.81 KiB removed -349.81 KiB (-100.00%)
contrib/google-cloud-cpp-cmake/CMakeFiles/google_cloud_cpp_grpc_utils.dir/__/google-cloud-cpp/googl… 346.93 KiB removed -346.93 KiB (-100.00%)
contrib/grpc-cmake/CMakeFiles/grpc_unsecure.dir/__/grpc/src/core/ext/transport/inproc/legacy_inproc… 345.35 KiB removed -345.35 KiB (-100.00%)
contrib/google-cloud-cpp-cmake/CMakeFiles/google_cloud_cpp_longrunning_operations_protos.dir/google… 339.33 KiB removed -339.33 KiB (-100.00%)
contrib/google-cloud-cpp-cmake/CMakeFiles/google_cloud_cpp_iam_credentials_v1_iamcredentials_protos… 334.24 KiB removed -334.24 KiB (-100.00%)
contrib/google-protobuf-cmake/CMakeFiles/_libprotobuf-lite.dir/__/google-protobuf/src/google/protob… 316.58 KiB removed -316.58 KiB (-100.00%)
Slowest function optimization changes (ThinLTO) ⚠️

Median per-function time ratio to the master baseline is ×1.17 (different machine and build flags); deltas below are relative to that ratio.

Binary Function Master PR Δ vs median
programs/clickhouse-keeper DB::SettingsTraits::Accessor::instance()::$_0::operator()() const [clone .llvm.3833315002542633314] new 18.2 s +18.2 s
programs/clickhouse-keeper DB::SettingsTraits::Accessor::instance()::$_0::operator()() const [clone .llvm.6969868754578406721] 8.5 s gone -9.9 s (-100%)
programs/clickhouse DB::SettingsTraits::Accessor::instance()::$_0::operator()() const [clone .llvm.6969868754578406721] 8.0 s gone -9.3 s (-100%)
programs/clickhouse-keeper DB::registerFunctionConversion(DB::FunctionFactory&) 6.9 s 14.8 s +6.8 s (+84%)
programs/clickhouse DB::SettingsTraits::Accessor::instance()::$_0::operator()() const [clone .llvm.3833315002542633314] new 6.3 s +6.3 s
programs/clickhouse-keeper _GLOBAL__sub_I_TargetLibraryInfo.cpp 5.9 s 11.8 s +4.9 s (+72%)
programs/clickhouse-keeper DB::ServerSettingsTraits::Accessor::instance()::$_0::operator()() const [clone .llvm.41530897155626… new 2.7 s +2.7 s
programs/clickhouse DB::Parquet::writeColumnChunkBody(DB::Parquet::ColumnChunkWriteState&, DB::Parquet::WriteOptions co… 5.2 s 3.4 s -2.7 s (-44%)
programs/clickhouse-keeper _ZN2DB18FunctionArrayIndexINS_16CountEqualActionENS_14NameCountEqualEE15executeIntegralIJDutjmDB8_s… 1.9 s 4.8 s +2.5 s (+111%)
programs/clickhouse DB::getSettingsChangesHistory()::$_0::operator()() const 4.3 s 2.6 s -2.4 s (-49%)
programs/clickhouse-keeper DB::MergeTreeSettingsTraits::Accessor::instance()::$_0::operator()() const [clone .llvm.12816159879… new 2.3 s +2.3 s
programs/clickhouse-keeper _GLOBAL__sub_I_sqid.cpp 1.7 s 4.2 s +2.2 s (+110%)
programs/clickhouse DB::Aggregator::writeToTemporaryFile(DB::AggregatedDataVariants&, unsigned long) const 3.4 s 1.8 s -2.2 s (-55%)
programs/clickhouse-keeper DB::ServerSettingsTraits::Accessor::instance()::$_0::operator()() const [clone .llvm.12822858084705… 1.8 s gone -2.1 s (-100%)
programs/clickhouse DB::ServerSettingsTraits::Accessor::instance()::$_0::operator()() const [clone .llvm.12822858084705… 1.7 s gone -2.0 s (-100%)
Compile time of recompiled translation units

6 translation units recompiled, 3 s compile time in total, 6 of them have a recent master baseline.

Symbol sizes

No symbol data for the master baseline yet (it is collected for release builds only since this check was introduced); the comparison will activate once master catches up.

Job report

@PedroTadim

Copy link
Copy Markdown
Member

@alexey-milovidov groeneai also has a fix PR for this #113034

@PedroTadim
PedroTadim added this pull request to the merge queue Aug 3, 2026
Merged via the queue into master with commit a425931 Aug 3, 2026
180 checks passed
@PedroTadim
PedroTadim deleted the fix-04650-one-match-deadline branch August 3, 2026 10:02
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 3, 2026
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.

4 participants