Skip to content

WebKit.WebContent High CPU Usage (60-75%) Causing Severe UI Lag on v0.7.48 #393

@damianpdr

Description

@damianpdr

Bug Report: WebKit.WebContent High CPU Usage Causing UI Lag

Description

CodexMonitor's WebKit.WebContent process consistently consumes 60-75% CPU and 1-1.7GB RAM, causing severe UI lag (500ms-2s delay on clicks) even on an M2 MacBook Pro with 16GB RAM.

Environment

  • CodexMonitor Version: 0.7.48
  • macOS: 15.6.1 (24G90)
  • Hardware: MacBook Pro M2 (Apple Silicon)
  • RAM: 16GB
  • Installation Method: DMG download from GitHub releases

Steps to Reproduce

  1. Launch CodexMonitor v0.7.48
  2. Wait 30-60 seconds for app to fully initialize
  3. Interact with UI (click sidebar items, switch threads)
  4. Observe significant lag on every interaction

Expected Behavior

UI should be responsive with <100ms click latency, WebKit process should idle at <5% CPU.

Actual Behavior

  • WebKit.WebContent process: 60-75% CPU, 1-1.7GB RAM
  • CodexMonitor main process: normal (~0-5% CPU, ~100-150MB RAM)
  • UI lag: 500ms-2s delay on every click
  • System load average spikes to 10-40

Process Details

PID 17784: WebKit.WebContent
- CPU: 66.2% → 75.3% (spikes)
- RAM: 1.0GB → 1.7GB (grows over time)
- Parent: launchd (system process)

Diagnostic Data

Memory Pressure:

  • System-wide free: 45-47% (was lower during peak usage)
  • Swap I/O active: 120,000+ swapouts observed
  • Compressed pages: 6M+ pages

Top Memory Consumers During Issue:

  1. WebKit.WebContent (CodexMonitor): ~1.7GB RAM, 75% CPU
  2. Google Chrome: ~2.9GB RAM (multiple processes)
  3. Antigravity (VS Code): ~1.6GB RAM
  4. Wispr Flow: ~0.6GB RAM

System State:

Load Avg: 3.56 - 40.24
PhysMem: 15G used (94% utilization)
Free RAM: ~74MB (critically low)

Attempted Workarounds

  1. Killed WebKit process manually - Immediate relief, but WebKit respawns and problem returns
  2. Restarted CodexMonitor - Process resets to ~150MB/0% CPU, then grows back to 1GB+/60%+ CPU within minutes
  3. Reduced workspaces - Removed several workspaces, minimal impact
  4. System restart - Not attempted yet
  5. Reset CodexMonitor settings - Not attempted yet (risk of losing workspace config)

Root Cause Analysis

The issue appears to be application-level, not system-level:

  • WebKit process consistently enters "spin loop" state after app startup
  • Problem persists across app restarts (fresh WebKit process exhibits same behavior)
  • Other Tauri/WebKit apps on same system do not show this behavior
  • CPU profile shows WebKit in IPC::Connection::dispatchIncomingMessages() loops

Hypothesis

Possible causes:

  1. React rendering loop - UI component stuck in infinite re-render cycle
  2. Thread status polling - Excessive polling of codex app-server processes
  3. WebSocket/IPC message flooding - Rapid message exchange between main process and WebKit
  4. Large workspace/thread list - Rendering performance issue with many items

Logs

WebKit process suspension logs show rapid foreground/background activity cycling:

ProcessThrottler::Activity::Activity: Starting foreground activity
ProcessThrottler::Activity::invalidate: Ending foreground activity
WebProcessProxy::didChangeThrottleState: type=1

Impact

  • Severity: High - App becomes unusable for productive work
  • Frequency: Always reproducible after app startup
  • Workaround: None effective (only temporary relief via process kill)

Request

Please investigate:

  1. Memory leak in React/Tauri frontend
  2. IPC message handling efficiency
  3. Thread/workspace polling frequency
  4. Any recent changes in v0.7.48 that might affect WebKit performance

Happy to provide additional diagnostics (sample traces, memory graphs, etc.) upon request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions