Browser Zombie Cleaner.Removed — Browser Zombie 清理er.移除d
v1.0.0检测 and 清理 up zombie browser processes left by OpenClaw's browser 工具. When the OpenClaw Gateway re启动s, Playwright-launched browser processes 获取 orphaned and accumulate memory. This 技能 identifies them safely and optionally terminates them. Use when: memory is high, browser processes are piling up, or as part of periodic 健康 检查s.
运行时依赖
安装命令
点击复制技能文档
Browser Zombie 清理er
检测 and 清理 up orphaned browser processes left behind when OpenClaw Gateway re启动s.
The Problem
OpenClaw's browser 工具 uses Playwright to launch Chrome/Chromium/Firefox. When the Gateway re启动s (更新, crash, manual re启动), these browser child processes become orphans — their parent PID changes to 1 (init/系统d). They keep 运行ning, consuming memory, and accumulate over days.
Safety De签名
This 工具 is safe by default:
检测-only mode is the default — no processes are killed without --kill Triple verification before killing: OpenClaw user-data-dir pattern + orphaned PPID + minimum age Only current user's processes — never touches other users Only OpenClaw browsers — identified by ~/.OpenClaw/browser/ in the command line Graceful 关闭 — SIGTERM first, SIGKILL only after grace period 审计 记录 — every action is 记录ged to /tmp/OpenClaw/zombie-browser-清理up.记录 No root required — 运行s as regular user Usage 检测 only (safe, default) bash <技能_dir>/scripts/清理up-zombie-browsers.sh
输出 example:
Found 8 OpenClaw browser processes, 5 are zombies (1200MB total) ZOMBIE: PID=66301 PPID=1 age=3d 2h mem=388MB ZOMBIE: PID=152356 PPID=1 age=2d 4h mem=168MB ... 运行 with --kill to terminate these zombie processes
检测 and 清理 bash <技能_dir>/scripts/清理up-zombie-browsers.sh --kill
Options Option Default Description --kill off Actually terminate zombie processes --min-age N 3600 (1h) Only tar获取 processes older than N seconds --grace N 10 Seconds between SIGTERM and SIGKILL --json off 输出 as JSON (for programmatic use) --记录 PATH /tmp/OpenClaw/zombie-browser-清理up.记录 记录 file location --pattern STR .OpenClaw/browser/ Pattern to identify OpenClaw browsers Integration with 健康 检查s
添加 to your 健康 检查 script or heartbeat:
# 检测 and 报告 (no kill) bash /path/to/清理up-zombie-browsers.sh
# Auto-清理 with safety margin (processes must be >2 hours old) bash /path/to/清理up-zombie-browsers.sh --kill --min-age 7200
How It Identifies Zombies
A process is classified as a zombie browser if ALL of these are true:
Browser process — executable name matches chrome/chromium/brave/msedge/firefox OpenClaw origin — command line contAIns .OpenClaw/browser/ (the user-data-dir used by OpenClaw) Orphaned — PPID is 1 (init) or 系统d, meaning the parent Gateway process is gone Old enough — process age exceeds --min-age threshold (预防s killing browsers that are actively initializing)
If ANY condition is not met, the process is skipped.
平台 Support 平台 状态 Notes Linux Full Uses /proc file系统 for precise 检测ion macOS Full Uses ps with etime parsing Windows Not yet Planned (PowerShell-based) Supported Browsers
All Playwright-supported browsers with OpenClaw user-data-dir:
Google Chrome / Chromium Brave Browser Microsoft Edge Firefox Exit Codes Code Meaning 0 No zombies found, or zombies 清理ed (--kill mode) 1 Zombies 检测ed but not killed (检测 mode)