Repository navigation
fix(host): raise the fd budget at startup and report it on store failures - #1687
Merged
Merged
Conversation
…ures A Desktop launched by Finder or launchd inherits a soft RLIMIT_NOFILE of 256, and that one process serves every session: measured 2026-11-25 on the running app (pid 90103, 14 h up), 185 descriptors with 44 of them SQLite (agent.db 22, app.db 13, tasks.db 5) — 72 % of the ceiling before any worker burst. Nothing raised it: grep for RLIMIT_NOFILE/setrlimit under desktop/ found nothing, while the TUI has had a production raise (tui/src/lib.rs:141) and the Agent's copy is #[cfg(test)]. - packages/fd (`future-fd`): one production copy of the raise — soft limit to min(WANT=8192, hard), upward only, idempotent, never fatal — plus the descriptor-count probe and the fields a failed store open must carry. - host: `environment::prepare_process_for` raises it before the first store or session is opened (the same hook both `futureos` and `future host` run), and `start_logging` reports the outcome once the host log exists. - A failed app-store open now logs `fds=<n> limit=<soft>/<hard> code=<n>` with what 13/14 mean; the Agent's event-journal storage failures carry the same detail, because the 2026-11-24 10:08:52Z window had SQLITE_FULL (13) beside CANTOPEN (14) and the two are indistinguishable without it. Tests: the raise is proved in a child process (lowered to 256 → 8192; a second call moves nothing; a 256 hard limit is respected), and both log lines are pinned — removing the raise or the detail turns them red.
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.
The Desktop and
future hostentry points now raise the process descriptor budget before opening any store or session, and a failed store open reports the descriptor count, the soft/hard limit and the SQLite code — so descriptor exhaustion is distinguishable from a broken database.Commits
fix(host): raise the fd budget at startup and report it on store failures — adds thefuture-fdcrate (one production copy of the raise: upward-only soft limit tomin(8192, hard), idempotent, never fatal, plus the descriptor probe and the fields a failed open carries), calls it fromenvironment::prepare_process_forbefore the first database open, records the resulting budget instart_logging, and putsfds=<n> limit=<soft>/<hard> code=<n>on failed app-store opens and Agent event-journal storage failures.Verification
Local, toolchain 1.99.1 (the repo pin),
ulimit -n 8192, at branch headde0373626:cargo fmt --all -- --check→ passcargo clippy -p future-fd -p future-host -p future-agent --all-targets -- -D warnings→ passcargo test -p future-fd --lib→ 5 passedcargo test -p future-host --lib→ 2350 passed, 15 ignoredcargo test -p future-agent --lib→ 3142 passed, 7 ignoredNotes
future-fd(packages/fd).event batch commit failedmessage now carries the same descriptor/SQLite detail.User-visible changes
RLIMIT_NOFILEof 256 for a process that serves every session (measured 185 descriptors, 44 of them SQLite, on a 14 h instance); after, the soft limit is raised tomin(8192, hard)at startup, upward only and idempotently. Rollback: revert this PR (branch commitde0373626).fds=<n> limit=<soft>/<hard> code=<n>, and the launch records itsfd budget:line. Rollback: same commit.