Skip to content

op-deployer: measure forge's peak memory instead of trusting forgeRunMemory #23995

Closed

Description

@sebastianst

Follow-up to #23664, part of #23300.

op-deployer limits concurrent forge runs per host by memory, using a hard-coded estimate of one run's peak memory on contracts-bedrock: forgeRunMemory = 1536 << 20 (slots.go:42). slotCount divides the container's memory limit by it (slots.go:44-52).

Nothing keeps that value current. When contracts-bedrock grows, the real peak exceeds the estimate. Then too many forge runs share a CI container, and jobs are OOM-killed as flakes instead of failing with a clear message.

Proposal

Measure the peak, and fail a test when it nears the estimate:

  1. After cmd.Run() in execWithEnv (client.go:429), read forge's peak RSS from cmd.ProcessState.SysUsage() (syscall.Rusage.Maxrss, KiB on Linux). Log it at debug level with the script name.
  2. Expose the peak to tests, and assert in a test that runs a real contracts-bedrock script. For example, one of the live runs in integration_test/apply_test.go. It should fail when a run exceeds about 90% of forgeRunMemory, and the message should give the measured value to bump the constant to.

Done when

  • A forge run's peak memory is logged.
  • A test that runs in CI fails before the estimate goes stale.

🤖 Co-created with Claude Opus 5.5

Activity

  1. sebastianst commented on Nov 9, 2026

    @sebastianst
    MemberAuthor

    🤖 Opus 5.5 says: Related: #24000 strips the AST from bundled artifacts, which cuts forge's peak memory from about 1.5 GB to about 0.37 GB per run. The check here should pin the new value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions