Skip to content

Add SYSTEM DISABLE ALL FAILPOINTS - #118877

Merged
alexey-milovidov merged 6 commits into
masterfrom
system-disable-all-failpoints
Sep 20, 2026
Merged

alexey-milovidov merged 6 commits into
masterfrom
system-disable-all-failpoints

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Related: #118863
Related: #118831
Related: #118832

Changelog category (leave one):

  • Improvement

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

Added SYSTEM DISABLE ALL FAILPOINTS, which disables every fail point at once and resumes any thread blocked on a pauseable one.

Description

Requested in the review of #118863.

SYSTEM ENABLE FAILPOINT arms a fail point for the whole server, and the only way to undo it is to name it again. Whoever needs a server that injects nothing has to know what somebody else armed - which a test harness cannot: a .sql test stops at its first unexpected error and a .sh test can be killed on timeout, so the name is exactly what is missing at that point. That is how one racy test took 04340_distributed_plan_status_reenqueue_fault down with it for three days (#118832).

SYSTEM DISABLE ALL FAILPOINTS disables every registered fail point and resumes whoever is blocked on a pauseable one, exactly as SYSTEM DISABLE FAILPOINT does for a single name.

  • Takes no argument, and no ON CLUSTER - fail points are node-local state, and none of the other SYSTEM ... FAILPOINT statements accept it either. Both are rejected as a syntax error, which the test asserts.
  • Requires the same SYSTEM FAILPOINT grant, so no new access type and no change to system.privileges.
  • Is a no-op rather than an error in a build without libfiu, where nothing can be armed in the first place. The other SYSTEM ... FAILPOINT statements throw there, but failing this one would only make every caller special-case a build flag in order to ask for a state that already holds.

ASTSystemQuery::Type reflects through magic_enum, so the new value gives the statement its keyword and its formatting for free; the enum's enum_range is already widened to 512 and 143 values fit. Two switches over the enum are exhaustive without a default and were extended, one of which (getRequiredAccessForDDLOnCluster) fails the build if a value is missed.

Verified by compiling the four changed translation units with the project's own flags (-Weverything -Werror), including a negative control: dropping the new value from getRequiredAccessForDDLOnCluster reproduces enumeration value 'DISABLE_ALL_FAILPOINTS' not handled in switch [-Werror,-Wswitch], so the check is not passing vacuously.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Workflow [PR]
Sync PR [sync-upstream/pr/118877]

Version info

  • Merged into: 26.10.1.303-master (included in 26.10 and later)

`SYSTEM ENABLE FAILPOINT` arms a fail point for the whole server, and the only way
to undo it is to name it again. Whoever needs a server that injects nothing has to
know what somebody else armed, which a test harness cannot: a `.sql` test stops at
its first unexpected error and a `.sh` test can be killed on timeout, so the name
is exactly what is missing at that point.

`SYSTEM DISABLE ALL FAILPOINTS` disables every registered fail point and resumes
whoever is blocked on a pauseable one, the same way `SYSTEM DISABLE FAILPOINT`
does for a single name. It takes no argument and, like the other
`SYSTEM ... FAILPOINT` statements, no `ON CLUSTER` - fail points are node-local
state. It requires the same `SYSTEM FAILPOINT` grant, and it is a no-op rather
than an error in a build without libfiu, where nothing can be armed in the first
place: failing it would only make every caller special-case a build flag to ask
for a state that already holds.

Suggested in the review of #118863,
which is where the harness will use it.

Related: #118831
Related: #118832

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@mintlify

mintlify Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
ClickHouse-docs 🟢 Ready View Preview Sep 19, 2026, 9:41 PM

alexey-milovidov added a commit that referenced this pull request Sep 8, 2026
`FailPointInjection::disableFailPoint` throws `BAD_ARGUMENTS` for a name it does not
know, so the names scraped out of prose or out of an `EXPLAIN` - `fp`,
`this_fail_point_does_not_exist`, and a handful of English words - each produced a
warning. Those names never armed anything, so skip them silently and keep the warning
for a server that actually stopped answering.

This goes away entirely once `SYSTEM DISABLE ALL FAILPOINTS`
(#118877) is in: the whole function
becomes that one statement, with no names to scrape.

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

clickhouse-gh Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [aaaf29c]

Summary: ❌

job_name test_name status info comment
Build profile diff ERROR

AI Review

Summary

This PR adds SYSTEM DISABLE ALL FAILPOINTS, wires it through parsing/interpreting, documents the new syntax, and adds stateless coverage for access control and wake-up behavior. The main implementation looks consistent, but the new wake-up regression is still fragile in two important ways and the structured privilege description is still stale, so the PR is not ready to approve yet.

Findings
  • ⚠️ [tests/queries/0_stateless/05225_system_disable_all_fault_injection_points_wakes_paused.sh:39] This regression arms server-wide failpoints and starts background clients without any EXIT cleanup. If the shell dies after line 39 because of a timeout or an unexpected error, later stateless tests can inherit infinite_sleep / dummy_pausable_failpoint still enabled and even a parked query still waiting on them, which recreates the exact cross-test contamination this feature is meant to prevent. Suggested fix: install a trap before the first SYSTEM ENABLE FAILPOINT that runs SYSTEM DISABLE ALL FAILPOINTS and reaps any background clients that may still be running.
  • 💡 [src/Access/Common/AccessType.h:403] The structured description of SYSTEM_FAILPOINT still advertises only SYSTEM ENABLE FAILPOINT, SYSTEM DISABLE FAILPOINT, and SYSTEM WAIT FAILPOINT. After this PR, users discovering privileges through system.privileges or generated grant documentation still will not see either SYSTEM DISABLE ALL FAILPOINTS or the pre-existing SYSTEM NOTIFY FAILPOINT, so the source of truth for what GRANT SYSTEM FAILPOINT covers remains stale. Suggested fix: extend the alias string for SYSTEM_FAILPOINT to enumerate the full statement set guarded by that privilege.
Tests
  • ⚠️ [tests/queries/0_stateless/05225_system_disable_all_fault_injection_points_wakes_paused.sh:55] Part 2 still treats “the WAIT query had not actually entered the server before SYSTEM DISABLE ALL FAILPOINTS ran” as a passing path. In that case the test proves only that WAIT returns immediately once the channel is already gone; it never exercises the disabled-flag wake-up path on an existing waiter, which is the main contract this regression is supposed to pin down. Suggested fix: make waiter startup part of the assertion with wait_for_query_to_start (or an equivalent hard failure on the explicit query_id) before disabling all failpoints.
Final Verdict

Status: ⚠️ Request changes

Minimum required actions:

  • Add robust EXIT cleanup to 05225_system_disable_all_fault_injection_points_wakes_paused.sh.
  • Make Part 2 of that regression fail if the WAIT query never actually starts before SYSTEM DISABLE ALL FAILPOINTS.
  • Update the SYSTEM_FAILPOINT privilege description in src/Access/Common/AccessType.h.

LLVM Coverage Report

Measured on commit aaaf29c.

Metric Baseline Current Δ
Lines 88.40% 88.40% +0.00%
Functions 91.80% 91.80% +0.00%
Branches 80.60% 80.70% +0.10%

Changed lines: Changed C/C++ lines covered: 57/66 (86.36%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added pr-improvement Pull request with some product improvements comp-testing Test content only (no production code). labels Sep 8, 2026
@clickhouse-gh clickhouse-gh Bot added comp-query-execution Runtime execution pipeline, processors, vectorized operators, resource management during execution. and removed comp-testing Test content only (no production code). labels Sep 8, 2026
@kirillshokhin

Copy link
Copy Markdown
Contributor

Renamed the test files to pass the style check

@clickhouse-gh

clickhouse-gh Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing commit aaaf29c6a3cd7f8fd90963a7ab22af520438fcd5 with master failed: RuntimeError: CI logs cluster query failed: SELECT file, countIf(side = 'pr') AS pr_cou….

See the job log for details.

alexey-milovidov and others added 2 commits September 17, 2026 08:00
…p, document it in the `SYSTEM` statement docs

- `05224_system_disable_all_failpoints_access`: the statement takes no name, so its
  `SYSTEM FAILPOINT` check has to be pinned on its own - `ACCESS_DENIED` without the
  privilege or with an unrelated `SYSTEM` privilege, success after `GRANT SYSTEM FAILPOINT`.
- `05225_system_disable_all_failpoints_wakes_paused`: proves the contract the statement
  exists for - a thread parked on `infinite_sleep` and a `SYSTEM WAIT FAILPOINT ... PAUSE`
  waiter are both released by `SYSTEM DISABLE ALL FAILPOINTS`, and a re-enabled fail
  point gets a fresh channel afterwards. Modelled on `04095_wait_fp_pause_disable`, but
  waits for the pause with `SYSTEM WAIT FAILPOINT ... PAUSE` instead of a fixed sleep.
- The `SYSTEM` statement docs are generated from `registerStatementSystem` in
  `ParserSystemQuery.cpp`, which had no fail point section at all; add one covering
  `ENABLE`, `DISABLE`, `DISABLE ALL`, `WAIT` and `NOTIFY FAILPOINT`, the no-`ON CLUSTER`
  rule and the required privilege, instead of relying on the `system.fail_points` page.
- Renumber `05141_system_disable_all_fault_injection_points` to `05223`, the next free
  number after merging master.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118877&sha=f082cbbce7e77e652b895559115023bc217a4daa&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%29 (Server unresponsive: memory limit exceeded) and provide a fix in a separate PR. If the fix is already in progress, link it here. It looks like the fleet-wide unattributable failure tracked in #111892: this PR only adds a SYSTEM statement that disables fail points, which the fuzzer does not exercise.

@groeneai

Copy link
Copy Markdown
Collaborator

Investigated: this is the #111892 family, and this occurrence is a container memcg kill of the server, misnamed by the result parser.

From that run's dmesg.log: oom-kill:constraint=CONSTRAINT_MEMCG, hierarchical_memory_limit 57740840960 (53.78 GiB), Killed process 2631 (clickhouse-serv) ... anon-rss:46471288kB (44.32 GiB). The task table at that instant accounts for the whole budget: server 44.32 GiB, gdb attached to the server 4.22 GiB, gdb attached to the fuzzer client 4.24 GiB, client and watchdog 0.15 GiB, kernel memory and page cache 0.86 GiB.

The server's ceiling was 40.33 GiB, i.e. 0.75 x 53.78: run-fuzzer.sh:86-88 sets only max_server_memory_usage_to_ram_ratio, and the 53.78 GiB is --memory = physical - 8 GiB from ast_fuzzer_job.py:251. So the 13.45 GiB the ratio leaves outside the server has to cover both resident gdb processes (8.46 GiB, run-fuzzer.sh:202 and :313, attached for the whole run) and the server's own resident memory above its ceiling, 3.99 GiB here. With the small terms that is 13.46 GiB, so the partition has no slack and the kill lands exactly at the margin. The last refusal in the job log shows where the resident memory comes from: would use 30.89 GiB (attempt to allocate chunk of 16.00 MiB), current RSS: 40.35 GiB, maximum: 40.33 GiB, so roughly 9.5 GiB of it is not live allocations, and the memcg counts it.

The row name is downstream of the same event: ast_fuzzer_job.py:544 greps dmesg for Out of memory: Killed process, oom_reaper: reaped process and constraint=CONSTRAINT_NONE, while a memcg kill writes Memory cgroup out of memory: Killed process and constraint=CONSTRAINT_MEMCG, so that branch does not fire (the grep exits 1 in this job.log). The parser then names the row after the last Code 241 in server.log (log_parser.py:414) and attaches a fuzzed aggregation that only lost the race to the cap. That is why the family reads as unattributable.

Fix status: nothing in flight covers this one. #118467 bounds path glob expansion, which was the driver on an earlier head of this family but is not the driver here. #116359 restores the named OOM result for these jobs but keeps the same three dmesg patterns, so it does not recognise a memcg kill either. I will open a separate PR that makes the fuzzer job's memory partition explicit and holds the server inside it, and extend #116359 to recognise the memcg kill rather than touch that block in two PRs. I will link the PR here.

@groeneai

Copy link
Copy Markdown
Collaborator

Correcting my earlier comment: the mechanism I gave was wrong, and the fix is already in progress, so I am not opening a separate PR.

The job's own fuzzer.log for f082cbbce7e77e652b895559115023bc217a4daa shows the terminal fuzz step (step 180) is

SELECT DISTINCT c0 FROM file(concat('{"a":[1,2,3],"b":"str"}{"a":[1,2,3],"b":"str"}...', currentDatabase())) GROUP BY 1 WITH TOTALS

with that group repeated 16 times. expandSelectorGlobImpl splits each {...} on its top-level commas, so {"a":[1,2,3],"b":"str"} yields 4 alternatives and the Cartesian product is 4^16 = 4,294,967,296 paths, each about 260 bytes, all collected into one vector. It runs under TableFunctionFile::parseFirstArguments -> getPathsList -> listFilesWithRegexpMatching -> expandSelectionGlob, i.e. while the table function is being resolved, so max_memory_usage does not stop it. The server reaches the job container's 53.78 GiB limit and the kernel kills it: oom-kill:constraint=CONSTRAINT_MEMCG in dmesg.log.

So #118467 is the fix for this failure: its MAX_EXPANDED_PATHS = 100000 refuses that expansion.

What I got wrong is worth recording, because it is the same trap for anyone else reading this row. I attributed the failure to the fuzzer job's memory partition after reading the Code: 241 the row is named after, and that query is a bystander. ci/jobs/ast_fuzzer_job.py greps dmesg only for host-OOM shapes (Out of memory: Killed process, oom-kill:constraint=CONSTRAINT_NONE), so a container OOM kill matches nothing, the OOM branch never fires, and FuzzerLogParser falls back to Server unresponsive: memory limit exceeded with whichever memory-limit exception was last in the server log. I will add the two cgroup shapes to that grep in #116359, which already rewrites that block.

groeneai added a commit to groeneai/ClickHouse that referenced this pull request Sep 17, 2026
The dmesg grep in the fuzzer jobs' OOM branch matched host-global kills only:
'Out of memory: Killed process', 'oom_reaper: reaped process' and
'oom-kill:constraint=CONSTRAINT_NONE'.

A cgroup-scoped kill writes none of them. The kernel prints
'oom-kill:constraint=CONSTRAINT_MEMCG' for the constraint, and its victim line
reads 'Memory cgroup out of memory: Killed process', whose lowercase
'out of memory' the existing capital-O pattern cannot match.

While that branch stays silent, FuzzerLogParser falls through to
'Server unresponsive: memory limit exceeded' and names whichever Code: 241 was
last in the server log, that is, a bystander query instead of the kill. That
fall-through name carries 90 rows across 42 pull requests in the last 30 days,
75 of them on the AST fuzzer amd_debug family.

Measured on two real dmesg captures of memcg kills of clickhouse-serv, from
ClickHouse#118877 head f082cbb and ClickHouse#120028 head 53f179a: the three existing patterns
match 0 lines in both, and the two added patterns match 1 line each, so the
branch does not fire before this change and does after it. The global-OOM
capture recorded earlier on this branch still matches, and the same capture
with its OOM lines removed still does not.

One downstream effect is deliberate and worth naming: a cgroup-scoped row now
lands as the synthetic 'OOM in dmesg' rather than as 'Server unresponsive:
memory limit exceeded', so revert_ci_regressions.py treats it as an aborted run
instead of investigating it. That is the intended reading, and it matches the
treatment this branch already gives the host-global kill. The old name was
assigned from whichever Code: 241 happened to be last in the server log, so it
named a bystander query and no single change to revert, while spending one of
the four investigation slots a run has. Per that file's own docstring an
over-inclusive list costs at most a wasted investigation, never a wrong revert.
@groeneai

Copy link
Copy Markdown
Collaborator

Done: 577ab1aac2933 in #116359 adds both cgroup shapes (oom-kill:constraint=CONSTRAINT_MEMCG and Memory cgroup out of memory: Killed process) to that grep.

Verified on this run's dmesg.log and on #120028's: the three old patterns match 0 lines and the two new ones 1 each, the recorded global-OOM capture still matches, an OOM-free capture still does not, and removing both new patterns restores the miss.

A test whose file name contains `fail` makes every log scanner that greps
for a failure report it, so the style check rejects such a name. Follow
`05223_system_disable_all_fault_injection_points`, which this change
already named that way.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
}

# --- Part 1: a thread parked on a pauseable fail point is released ---
$CLICKHOUSE_CLIENT -q "SYSTEM ENABLE FAILPOINT infinite_sleep"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test starts arming server-wide failpoints here, but it never installs any EXIT cleanup. If the shell dies after this point because the job times out or the script hits an unexpected error, later stateless tests can inherit infinite_sleep / dummy_pausable_failpoint still enabled and even a paused query still parked on them. That is the same failure mode this feature exists to clean up.

Please add a trap before the first SYSTEM ENABLE FAILPOINT, e.g. trap '$CLICKHOUSE_CLIENT -q "SYSTEM DISABLE ALL FAILPOINTS" 2>/dev/null || true' EXIT, and reap any background clients if needed.


# Let the waiter reach the server before disabling. If it arrives late anyway the channel is
# already gone and `WAIT` returns at once, so the assertion below cannot hang either way.
for _ in $(seq 1 100)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only a best-effort delay, but this regression is the sole proof that SYSTEM DISABLE ALL FAILPOINTS wakes a SYSTEM WAIT FAILPOINT ... PAUSE waiter through the disabled flag path. If the WAIT query has not actually entered the server within these 10 seconds, line 64 still runs and the test passes on the weaker “channel was already gone, so WAIT returned immediately” path without ever exercising waitForPause on an existing channel.

Please make the waiter-start condition part of the assertion. shell_config.sh already provides wait_for_query_to_start, and you already assign an explicit query_id, so this can be made deterministic instead of silently accepting the uncovered path.


`SYSTEM WAIT FAILPOINT ... PAUSE` blocks until a thread pauses on the given pauseable fail point (or the fail point is disabled), `... RESUME` blocks until the paused thread is resumed, and `SYSTEM NOTIFY FAILPOINT` resumes the paused threads without disabling the fail point.

Fail points are node-local state, so none of these statements accept `ON CLUSTER`. All of them require the `SYSTEM FAILPOINT` privilege.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section correctly says that all of these statements use SYSTEM FAILPOINT, but the structured privilege description in src/Access/Common/AccessType.h still advertises only SYSTEM ENABLE FAILPOINT, SYSTEM DISABLE FAILPOINT, and SYSTEM WAIT FAILPOINT (it also misses the pre-existing SYSTEM NOTIFY FAILPOINT). Adding a new surface without updating that source of truth leaves system.privileges / grant documentation stale for users trying to discover what GRANT SYSTEM FAILPOINT covers.

Please extend the SYSTEM_FAILPOINT description while you are here so it enumerates the full statement set guarded by that privilege.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing!

This branch was successfully deployed

1 active deployment
staging - docs — aaaf29c6 Deployed Sep 19, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-query-execution Runtime execution pipeline, processors, vectorized operators, resource management during execution. pr-improvement Pull request with some product improvements 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