Skip to content

Clean up macOS runners: disable file-change history, Time Machine and desktop agents, erase logs at boot, reboot every three days - #121990

Merged
leshikus merged 5 commits into
ClickHouse:masterfrom
leshikus:macos-runner-fseventsd-reboot
Sep 25, 2026
Merged

leshikus merged 5 commits into
ClickHouse:masterfrom
leshikus:macos-runner-fseventsd-reboot

Conversation

@leshikus

@leshikus leshikus commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Disk usage on mac2-m2pro.metal runners was measured in the middle of a test load, so most of it (swap, the _work checkout) is expected. Three things persist across test runs and reboots: up to 7.6 GB of /.fseventsd file-change history, 6.3-6.6 GB of unified-log uuidtext and 0.5 GB of Homebrew downloads.

  • runner-init runs log erase --all at startup, which happens once per boot.
  • Provisioning puts a no_log marker into /System/Volumes/Data/.fseventsd, runs brew cleanup, disables Time Machine (which can take local APFS snapshots) and disables Photos analysis, Siri, iCloud and location services.
  • macOS runners get a three-day max_life, which drops swap and other state accumulated across test runs. The check runs between jobs, and the exception it raises makes user_data reboot the instance.
  • The init script version goes from 76 to 77 so the fleet re-provisions.

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

🤖 Generated with Claude Code


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

Version info

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

leshikus and others added 2 commits September 24, 2026 15:15
On long-running `mac2-m2pro.metal` runners the root volume reached 75-83%:
50-59 GB of swap files left by leaked memory, which only a reboot frees,
plus about 7.6 GB of `/.fseventsd` file-change history that survives reboots.

- Put a `no_log` marker into `/System/Volumes/Data/.fseventsd` during
  provisioning, so `fseventsd` stops persisting history from the next boot.
- Give macOS runners a three-day `max_life`. The check runs between jobs;
  the raised exception makes `user_data` reboot the instance.
- Bump the version so the fleet re-provisions.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Runners have no backup destination, but an enabled Time Machine can still
take local APFS snapshots of the root volume.

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

clickhouse-gh Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [0b5ad25]

Summary: ✅


AI Review

Summary

This PR reduces persistent disk usage on macOS runners by erasing unified logs at boot, disabling several background services, suppressing /.fseventsd history, and rebooting runners after roughly three days with jitter. The remaining issue is that planned max_life retirement still takes the generic macOS failure path, so every ordinary age-out drops PROVISION_MARKER and reruns the full version-gated provisioning on the next boot.

Findings
  • ⚠️ Majors
    • [ci/praktika/infrastructure/runner/runner-init.py:250-251, 547-559, 1083-1089] [dismissed by author -- https://github.com/Clean up macOS runners: disable file-change history, Time Machine and desktop agents, erase logs at boot, reboot every three days #121990#discussion_r4094548254] configure_darwin still documents a config.version gate, but the new planned max_life exit raises the same generic Exception as a real provisioning failure and the top-level macOS handler unconditionally unlinks PROVISION_MARKER. Every normal three-day reboot therefore reruns the full macOS bootstrap (brew install, extra pip install --upgrade, CloudWatch reinstall, actions-runner re-extract) even when config.version is unchanged, which adds avoidable reboot downtime and lets the CI environment drift on a timer rather than on reviewed version bumps.
    • Suggested fix: give planned retirement its own exit path and preserve PROVISION_MARKER for that path. Only clear the marker when you actually need to force configure_darwin to rerun after a provisioning failure or an init-script upgrade.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
    • Preserve PROVISION_MARKER on ordinary max_life age-out reboots so the config.version gate remains meaningful.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 24, 2026
@clickhouse-gh
clickhouse-gh Bot requested a review from maxknv September 24, 2026 13:19
leshikus and others added 2 commits September 24, 2026 15:20
`/private/var/db/uuidtext` reached 6.3-6.6 GB on long-running runners.
runner-init starts once per boot, so erasing logs there bounds their size
to one boot. Photos analysis, Siri, iCloud and location services have no
use on a CI runner.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The disk usage was measured in the middle of a test load, so swap and the
`_work` checkout are expected there, not a leak. The persistent leftovers
are `/.fseventsd`, unified-log `uuidtext` and about 0.5 GB of Homebrew
downloads, which `brew cleanup` now removes after installing packages.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@leshikus leshikus added the can be tested Allows running workflows for external contributors label Sep 24, 2026
@leshikus leshikus changed the title Disable /.fseventsd history and Time Machine, reboot macOS runners every three days Clean up macOS runners: disable file-change history, Time Machine and desktop agents, erase logs at boot, reboot every three days Sep 24, 2026
@leshikus
leshikus marked this pull request as ready for review September 24, 2026 14:03
@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Sep 24, 2026
@maxknv

maxknv commented Sep 25, 2026

Copy link
Copy Markdown
Member

LGTM


if config.init_environment == Environment.MACOS:
# Drop swap files and other state accumulated across test runs.
config.max_life = 3600 * 24 * 3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we need some random offset + 3600 * random(0,24) to not reboot all instances at the same time

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 0b5ad2538c50d

Review comment ClickHouse#121990 (comment)
asked for a random offset on the 3-day macOS `max_life`, so that not all
instances reboot at the same time.

The concern holds: bumping the runner-init `version` makes every macOS
runner re-provision within minutes of each other, which aligns their
`runner_start_time`; with a fixed `max_life` they would all age out and
reboot together three days later, taking the whole macOS capacity offline.

Add `900 * random.randint(0, 24)` seconds (0 to 6 hours in 15-minute steps)
to `max_life`, chosen once per runner-init start.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@clickhouse-gh
clickhouse-gh Bot requested a review from maxknv September 25, 2026 17:13
@leshikus
leshikus added this pull request to the merge queue Sep 25, 2026
Merged via the queue into ClickHouse:master with commit 3df9267 Sep 25, 2026
176 checks passed
@leshikus
leshikus deleted the macos-runner-fseventsd-reboot branch September 25, 2026 17:29
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 25, 2026
@leshikus

Copy link
Copy Markdown
Collaborator Author
i-0baf2f8e09ca1834f     Success Filesystem        Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk5s2s1   100Gi    12Gi    50Gi    19%    455k  519M    0%   /

i-0a3e50c6e8e2cb29e     Success Filesystem        Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk5s2s1   100Gi    12Gi    56Gi    18%    455k  591M    0%   /

i-0958a5625ce1eb8c4     Success Filesystem        Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk5s2s1   100Gi    12Gi   756Mi    95%    455k  7.7M    6%   /

i-061fefab769b250bb     Success Filesystem        Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk5s2s1   100Gi    12Gi    57Gi    17%    455k  594M    0%   /

i-05d6e92b58eb1ee38     Success Filesystem        Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk5s2s1   100Gi    12Gi    57Gi    17%    455k  594M    0%   /

i-04af1537ae54658c2     Success Filesystem        Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk5s2s1   100Gi    12Gi    54Gi    18%    455k  566M    0%   /

i-03e16969c5decb159     Success Filesystem        Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk5s2s1   100Gi    12Gi    61Gi    16%    455k  642M    0%   /

i-01e6142d8124b415b     Success Filesystem        Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk5s2s1   100Gi    12Gi    60Gi    17%    455k  630M    0%   /

i-018c006d2a7dbea45     Success Filesystem        Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk5s2s1   100Gi    12Gi    58Gi    17%    455k  612M    0%   /

i-0185ba3bb1613596b     Success Filesystem        Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk5s2s1   100Gi    12Gi    60Gi    17%    455k  628M    0%   /

aschoube pushed a commit to aschoube/ClickHouse that referenced this pull request Oct 8, 2026
…win)

The macOS runners fill their 100G EBS boot container again (Code 243
NOT_ENOUGH_SPACE, e.g. job 112074232546 on ClickHouse#122138 started with / 97% full).
The job logs show the growth is host state outside the job workspace: the
same jobs leave almost nothing behind on some hosts and 0.6-0.75 GB per job
on others, and only a reboot (same instance id) resets a host to 43-45%. No
host went back to that level between 2026-09-28 and 2026-10-04, although
runner-init v77 (ClickHouse#121990) gives macOS runners a 3-day lifetime. GNU df on
APFS prints one container-wide number for every volume, so the existing
df -h output cannot say what grows, and the hosts cannot be inspected
directly.

Print, at job start (what earlier jobs left behind) and at job end: uptime,
boot time, memory size, swap usage, memory pressure level, the provisioned
and running runner-init versions, the swap files, Capacity Consumed per
APFS volume, deleted-but-open regular files with their holders, and the 10
largest processes by memory. At job start, when the data volume is at least
60% used, also list directories of 1 GiB or more (healthy hosts sit at
42-50%, so this only runs on a filling host).

Everything is read-only. diskutil, lsof and du run under GNU timeout (30,
60, 120 s; gnubin is first in the macOS job PATH), outside sudo so that
sudo's secure_path does not hide it; sudo -n never prompts; listings are
head-bounded. The test exit code is captured before the end call and the
teardown still always runs (no set -e).

The wrapper is in darwin_fast_test_digest_config, so a change to it runs
the job, and this commit's own CI samples one host. The fix for whatever
the output names follows separately.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). 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.

3 participants