Repository navigation
feat: Stim Host helper restarts a bloated fseventsd - #6602
Merged
Merged
Conversation
The opt-in root helper now lists fseventsd and measures memory as the larger of RSS and physical footprint, since RSS leaves out compressed and swapped pages. The fseventsd memory culprit suggests the helper setup command instead of sudo killall. Fixes #6600
janicduplessis
marked this pull request as ready for review
November 28, 2026 00:48
janicduplessis
enabled auto-merge (squash)
November 28, 2026 00:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Stim Desktop showed "fseventsd uses 82.68 GB" and told the user to run
sudo killall fseventsd. The opt-in root helper in Stim Host (#6256) already restarts runaway Apple services, but fseventsd was not on its allowlist. The maintainer asked for the helper to handle it (quotes in #6600 and LLP 0001).Second problem: the helper measured memory with RSS (
pti_resident_size), which leaves out compressed and swapped pages. On the maintainer's MacBook fseventsd had about 10 GB RSS against a 77 GiB footprint (67 GiB compressed). Once the machine swaps harder, RSS can fall under the 2 GiB limit while the footprint keeps growing. #5910 covers an earlier 52 GB case.Solution
helper_pathsgets fseventsd's exact path,/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/Support/fseventsd, checked withps -o comm=on macOS 27.0 (26A428). It goes at the end of the list because log lines and restored cooldowns refer to a service by its index.ri_phys_footprintwithproc_pid_rusage(it runs as root, so this works for root daemons) and compares the larger of RSS and footprint with the 2 GiB limit. This applies to all six services, not only fseventsd. Footprint can only raise the measured value, so every process that qualified before still qualifies. If the call fails, the footprint is 0 and RSS is used as before. Sample, restart and result log lines get afootprintfield; the core reader ignores unknown fields.This PR changes only the helper source. Macs get the new behavior only after a new
host-v*release is pinned inpackages/server/src/stim-host.ts, so the CLI still printssudo killall fseventsd. Advisingstim service install --helpernow would install the 0.2.0 helper, which does not restart fseventsd. The pin PR switches the advice, the guides, the website and the Desktop copy, and handles helpers that are already registered: those keep running their old binary after the bundle is updated (#6604, #6601).Risk: the helper will signal one more root daemon. The worst case is one extra rescan by file watchers, at most once an hour.
Test plan
pnpm test packages/server/__tests__/helper-policy.integration.test.tson macOS: the policy fixture checks that the fseventsd path matches index 5 and that/usr/sbin/fseventsddoes not match. The files and retry fixtures compile the realstim-host-helper.cwith the newproc_pid_rusagecall.stim-host-helper.cuniversal with therelease.shflags (-Wall -Wextra -Werror -arch arm64 -arch x86_64).proc_pid_rusagefootprint for its own pid. A non-root process cannot read fseventsd, so the helper's root read was not exercised, and fseventsd was not signalled.Release after merge: tag
host-v<next>onmainso the Stim Host release workflow signs and notarizes it, then follow #6604 to pin it (seeRELEASE.md"Stim Host releases").Fixes #6600