openclaw - 💡(How to fix) Fix Add default container resource limits for sandbox [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#60827Fetched 2026-04-08 02:46:42
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Sandbox containers created by OpenClaw have no CPU or memory limits by default. On a resource-constrained host (e.g., 8GB Mac mini running 6+ sandboxed agents), a single runaway agent can consume all host RAM and crash the gateway, other agents, and host services.

Root Cause

Sandbox containers created by OpenClaw have no CPU or memory limits by default. On a resource-constrained host (e.g., 8GB Mac mini running 6+ sandboxed agents), a single runaway agent can consume all host RAM and crash the gateway, other agents, and host services.

Code Example

"sandbox": {
  "docker": {
    "memory": "512m",
    "cpus": 0.5,
    "pidsLimit": 256
  }
}

---

{
  "sandbox": {
    "defaults": {
      "docker": {
        "memory": "512m",
        "cpus": 0.5,
        "pidsLimit": 256
      }
    }
  }
}
RAW_BUFFERClick to expand / collapse

Description

Sandbox containers created by OpenClaw have no CPU or memory limits by default. On a resource-constrained host (e.g., 8GB Mac mini running 6+ sandboxed agents), a single runaway agent can consume all host RAM and crash the gateway, other agents, and host services.

Current Behavior

New sandbox containers have no CPU or memory limits unless the operator explicitly configures per-agent overrides in openclaw.json. Per-agent overrides work today:

"sandbox": {
  "docker": {
    "memory": "512m",
    "cpus": 0.5,
    "pidsLimit": 256
  }
}

However, the global sandbox defaults (sandbox.defaults.docker) do not include resource limits. Any new agent added to a deployment starts with unlimited resources unless the operator knows to add overrides.

New deployments and new agents are wide open by default, even though the rest of the hardening (readonly rootfs, cap-drop ALL, no-new-privileges) is applied automatically.

Proposed Behavior

Add resource limits to the global sandbox defaults so new agents get sane limits out of the box:

{
  "sandbox": {
    "defaults": {
      "docker": {
        "memory": "512m",
        "cpus": 0.5,
        "pidsLimit": 256
      }
    }
  }
}

Per-agent overrides already work for operators who need to customize. The ask is for the defaults to be secure, so new deployments don't start wide open.

Rationale

The existing container hardening (readonly rootfs, dropped caps, no-new-privileges, non-root user) is excellent for privilege containment. But without resource limits, the blast radius of a bug or adversarial prompt that triggers infinite loops, large allocations, or fork bombs is the entire host.

This matters especially for:

  • Multi-agent deployments with many concurrent containers
  • Hosts with limited RAM (Mac mini, Raspberry Pi, small VPS)
  • Cron jobs running unattended — a stuck job can OOM the host overnight

Suggested Defaults

SettingDefaultRationale
memoryMb512Sufficient for most agent tasks; prevents single-agent OOM
cpus0.5Prevents CPU monopolization while allowing reasonable throughput

These should be overridable at the agent level for power users.

Labels

enhancement, security, sandboxing

extent analysis

TL;DR

Add resource limits to the global sandbox defaults in openclaw.json to prevent new agents from consuming all host resources by default.

Guidance

  • Update the openclaw.json file to include resource limits in the global sandbox defaults, as shown in the proposed behavior section.
  • Set memory to a reasonable value (e.g., "512m") and cpus to a value that prevents CPU monopolization (e.g., 0.5) to prevent single-agent out-of-memory (OOM) errors and CPU overload.
  • Ensure that per-agent overrides are still possible for operators who need to customize resource limits for specific agents.
  • Test the updated configuration with new agent deployments to verify that the resource limits are applied correctly.

Example

{
  "sandbox": {
    "defaults": {
      "docker": {
        "memory": "512m",
        "cpus": 0.5,
        "pidsLimit": 256
      }
    }
  }
}

Notes

The suggested defaults for memoryMb and cpus may need to be adjusted based on the specific use case and host resources. It's essential to test the updated configuration to ensure that the resource limits are reasonable and do not negatively impact agent performance.

Recommendation

Apply the workaround by updating the openclaw.json file with the proposed global sandbox defaults, as this will provide a secure and reasonable default configuration for new agent deployments.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING