Skip to content

fc-agent times the container-state read and bounds the reap after a timeout - #1313

Merged
ejc3 merged 1 commit into
mainfrom
restore-hook-inspect-timing
Oct 27, 2026
Merged

ejc3 merged 1 commit into
mainfrom
restore-hook-inspect-timing

Conversation

@ejc3

@ejc3 ejc3 commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

fc-agent now times its container-state read before the restore hook, so the 10 s budget on that read can be judged against measurements. It also bounds the reap after a bounded command times out.

Why

Before the restore hook runs, fc-agent asks podman inspect whether fcvm-container runs. The read has a 10 s budget, and running out fails the restore closed. On a 72-CPU host, I restored clones of a 128 GiB www snapshot at the same moment, and the run queue sat at 82 to 123. Four of the five second and third clones failed at this read; clones restored one at a time passed. Nothing recorded how long the read takes, either in a healthy restore or a starved one. A budget change without those numbers would be a guess.

The change

  • The read is timed. When podman returns, a log line gives its exit code and elapsed_ms, and a failure carries elapsed_ms in its error.
  • A bounded command that runs out (run_bounded, which also runs the hook) now says it hit its budget and how long the reap after the kill took, or that the wait failed, or that the pid was not reaped. It also carries fc-agent's vitals line and the guest's blocked threads and per-CPU ticks, steal included, which tell a host that is not running the vCPUs from a busy guest. The vitals are read off the tokio worker.
  • The reap has its own 5 s bound. A child stuck in uninterruptible sleep does not die on SIGKILL, and the old unbounded wait would have left the restore hanging with ingress gated instead of failing closed.

Evidence

$ make test-agent-unit
     Summary [  71.270s] 274 tests run: 274 passed (1 slow), 0 skipped

Red: with the old one-line timeout error, a_hook_past_its_budget_is_killed fails on its new assertions. a_timeout_names_a_child_that_was_not_reaped pins the other two messages.

Measured on a test host (72 CPUs) with this commit applied to main: an nginx:alpine VM booted with the new fc-agent, snapshotted, and restored five times with fcvm snapshot run --snapshot <tag> --on-restore true:

clone 1: podman inspect before the restore hook returned code=0 elapsed_ms=378 | "ack_ms":1256
clone 2: podman inspect before the restore hook returned code=0 elapsed_ms=315 | "ack_ms":724
clone 3: podman inspect before the restore hook returned code=0 elapsed_ms=322 | "ack_ms":774
clone 4: podman inspect before the restore hook returned code=0 elapsed_ms=346 | "ack_ms":757
clone 5: podman inspect before the restore hook returned code=0 elapsed_ms=301 | "ack_ms":697

So the healthy read takes about a third of a second, against the 10 s budget. A restored clone runs the fc-agent its snapshot was booted with, so the www snapshots on that host, all booted before this change, do not log the line. www numbers come with the first snapshot prepared after it merges.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 26f7856b-bd6b-4f2d-baca-53854d952ceb
Commits

Reviewing files that changed from the base of the PR and between 92bb570 and d68940f.

Files selected for processing: 3
  • fc-agent/src/restore.rs
  • fc-agent/src/snapshot_network.rs
  • fc-agent/src/vitals.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T21:48:15.348070Z d68940f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ejc3
ejc3 force-pushed the restore-hook-inspect-timing branch from 67ab9d3 to 5af8809 Compare October 26, 2026 02:37
@ejc3 ejc3 changed the title fc-agent logs how long the container-state read before the restore hook takes fc-agent times the container-state read and bounds the reap after a timeout Oct 26, 2026
…imeout

Before the restore hook runs, fc-agent reads whether fcvm-container runs (`podman inspect`) with a
10 s budget, and a read that runs out fails the restore closed. Two clones of a 128 GiB www snapshot
restored at once on a 72-CPU host held the run queue at 82 to 123, and 4 of the 5 second and third
clones failed there; clones restored one at a time passed. Nothing recorded how long the read takes,
so neither the healthy distribution nor how far a starved read is from the budget was known.

The read is now timed: when podman returns, a log line gives its exit code and elapsed_ms, and a
failure carries elapsed_ms in its error. A bounded command that runs out (run_bounded, which also
runs the hook) now says it hit its budget, how long the reap after the kill took (or that the wait
failed, or that the pid was not reaped), fc-agent's vitals line, and the guest's blocked threads and
per-CPU ticks with steal, which tell a host that is not running the vCPUs from a busy guest. The
vitals are read off the tokio worker. The reap has its own 5 s bound: a child stuck in
uninterruptible sleep does not die on SIGKILL, and the unbounded wait would have left the restore
hanging with ingress gated instead of failing closed.

Tested: make test-agent-unit (274 passed); make clippy; cargo check -p fc-agent for both musl
targets. Red: with the old one-line timeout error, a_hook_past_its_budget_is_killed fails on its new
assertions; a_timeout_names_a_child_that_was_not_reaped pins the other two messages.
@ejc3
ejc3 force-pushed the restore-hook-inspect-timing branch from 5af8809 to d68940f Compare October 26, 2026 02:58
@ejc3

ejc3 commented Oct 26, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@ejc3

ejc3 commented Oct 26, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: d68940f57c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ejc3 ejc3 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

NOT-A-DEFECT: CodeRabbit's comments on this PR are its review-limit notices and summary edits after description changes; they carry no finding. Codex reported no findings on d68940f.

@ejc3
ejc3 merged commit 3a87ff7 into main Oct 27, 2026
17 checks passed
@ejc3
ejc3 deleted the restore-hook-inspect-timing branch October 27, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant