Date: 2025-11-28 Bun Version: 1.3.3 Platform: macOS Darwin 24.6.0 (ARM64)
Lootbox server running at 100% CPU for 9+ hours. Main server process only - worker processes at 0% CPU.
PID 30968 - 100% CPU, 1786MB RSS, running for 566 minutes
Workers (3 active) - all at 0% CPU
{
"status": "degraded",
"healthy": false,
"warnings": [
"High CPU usage: 100.0%",
"High memory usage: 1785.7MB RSS"
],
"metrics": {
"eventLoopLagMs": 0,
"activeHandles": 0,
"activeRequests": 0
}
}829 samples total (100% CPU time)
├── 796 samples in socket/recv handling
│ ├── 526 in recvfrom (network receiving)
│ └── 231 in kevent64 (event polling)
Key observation: 0ms event loop lag with 100% CPU indicates busy-polling, not blocked I/O.
3 established WebSocket connections (MCP bridge clients)
tcp6 ::1.3456 <-> ::1.51358 ESTABLISHED
tcp6 ::1.3456 <-> ::1.62716 ESTABLISHED
tcp6 ::1.3456 <-> ::1.61599 ESTABLISHED
// websocket_server.ts line 244-248
websocket: {
// DEBUG: Testing WebSocket options to fix CPU spin
idleTimeout: 0, // Disable idle timeout to prevent keep-alive polling
perMessageDeflate: false, // Disable compression
sendPings: false, // Disable automatic pingsThese options were already attempted as mitigations but didn't resolve the issue.
- oven-sh/bun#21654 - 100% CPU on Linux/macOS
- oven-sh/bun#16473 - WebSocket crashes after hours
- oven-sh/bun#6366 - Bun.serve hangs with 100% CPU
- oven-sh/bun#17166 - Crash after running several days
pkill -f "lootbox-cli.ts server" && sleep 2 && lootbox server# Add to crontab -e
0 */8 * * * pkill -f "lootbox-cli.ts server" && sleep 5 && cd ~/dev/lootbox-bun && lootbox server#!/bin/bash
while true; do
lootbox server
echo "Server exited, restarting in 5s..."
sleep 5
done- Upgrade Bun - Test with latest version
- HTTP Long-Polling - Replace WebSocket with HTTP for MCP bridge
- Different WebSocket library - Use ws or uWebSockets.js directly
- Connection timeout - Auto-close idle WebSocket connections
- Process isolation - Run WebSocket server in separate process
- Start lootbox server:
bun run src/lootbox-cli.ts server --port 3456 - Connect 2-3 MCP bridge clients (Claude Code sessions)
- Wait 6-12 hours
- Observe: CPU climbs to 100%, stays there indefinitely
OS: macOS 15.6.1 (Darwin 24.6.0)
Arch: ARM64 (Apple Silicon)
Bun: 1.3.3
Node: (via Bun compatibility)