← 返回
数据分析

Browser Zombie Cleaner

Detect and clean up zombie browser processes left by OpenClaw's browser tool. When the OpenClaw Gateway restarts, Playwright-launched browser processes get o...
检测并清理 OpenClaw 浏览器工具遗留的僵尸浏览器进程。当 OpenClaw Gateway 重启时,Playwright 启动的浏览器进程会被遗弃。
guoqunabc
数据分析 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 552
下载
💾 14
安装
1
版本
#latest

概述

Browser Zombie Cleaner

Detect and clean up orphaned browser processes left behind when OpenClaw Gateway restarts.

The Problem

OpenClaw's browser tool uses Playwright to launch Chrome/Chromium/Firefox. When the Gateway

restarts (update, crash, manual restart), these browser child processes become orphans — their

parent PID changes to 1 (init/systemd). They keep running, consuming memory, and accumulate

over days.

Safety Design

This tool is safe by default:

  1. Detect-only mode is the default — no processes are killed without --kill
  2. Triple verification before killing: OpenClaw user-data-dir pattern + orphaned PPID + minimum age
  3. Only current user's processes — never touches other users
  4. Only OpenClaw browsers — identified by ~/.openclaw/browser/ in the command line
  5. Graceful shutdown — SIGTERM first, SIGKILL only after grace period
  6. Audit log — every action is logged to /tmp/openclaw/zombie-browser-cleanup.log
  7. No root required — runs as regular user

Usage

Detect only (safe, default)

bash <skill_dir>/scripts/cleanup-zombie-browsers.sh

Output 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
  ...
Run with --kill to terminate these zombie processes

Detect and clean

bash <skill_dir>/scripts/cleanup-zombie-browsers.sh --kill

Options

OptionDefaultDescription
------------------------------
--killoffActually terminate zombie processes
--min-age N3600 (1h)Only target processes older than N seconds
--grace N10Seconds between SIGTERM and SIGKILL
--jsonoffOutput as JSON (for programmatic use)
--log PATH/tmp/openclaw/zombie-browser-cleanup.logLog file location
--pattern STR.openclaw/browser/Pattern to identify OpenClaw browsers

Integration with Health Checks

Add to your health check script or heartbeat:

# Detect and report (no kill)
bash /path/to/cleanup-zombie-browsers.sh

# Auto-clean with safety margin (processes must be >2 hours old)
bash /path/to/cleanup-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:

  1. Browser process — executable name matches chrome/chromium/brave/msedge/firefox
  2. OpenClaw origin — command line contains .openclaw/browser/ (the user-data-dir used by OpenClaw)
  3. Orphaned — PPID is 1 (init) or systemd, meaning the parent Gateway process is gone
  4. Old enough — process age exceeds --min-age threshold (prevents killing browsers that are actively initializing)

If ANY condition is not met, the process is skipped.

Platform Support

PlatformStatusNotes
-------------------------
LinuxFullUses /proc filesystem for precise detection
macOSFullUses ps with etime parsing
WindowsNot yetPlanned (PowerShell-based)

Supported Browsers

All Playwright-supported browsers with OpenClaw user-data-dir:

  • Google Chrome / Chromium
  • Brave Browser
  • Microsoft Edge
  • Firefox

Exit Codes

CodeMeaning
---------------
0No zombies found, or zombies cleaned (--kill mode)
1Zombies detected but not killed (detect mode)

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 21:22 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 198 📥 65,147
data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 368 📥 140,526
data-analysis

A股量化 AkShare

mbpz
A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
★ 165 📥 60,049