Bug Report
Reporter: @yyovil
Environment: macOS, Nix-managed Node.js 22.22.1 (nodejs-slim via Nix store), branch feat/droid-agent-plugin
Summary
Running ao start causes the Next.js dev server to consume ~4GB+ of heap memory and crash with a fatal OOM error. The process aborts and the user is forced to kill all running applications to recover system memory.
Crash Details
[next] FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Pre-crash errors observed in terminal:
[direct-terminal] [SessionBroadcaster] fetchSnapshot error: This operation was aborted
[direct-terminal] [MuxServer] Mux connection closed
GC data (last cycles before crash):
Scavenge / Mark-Compact — heap usage ~4087 MB to ~4135 MB
Stack trace highlights:
- V8 engine heap allocation failures (
v8::internal::Heap::AllocateRawWithLightRetrySlowPath)
v8::internal::Runtime_AllocateInYoungGeneration
Builtins_StringSlowFlatten, Builtins_PromiseFulfillReactionJob
- libuv event loop (
uv__io_poll, uv_run)
- Final:
abort ao start — process exits with code null
Full native stack trace (37 frames):
1: 0x10429c9d4 node::OOMErrorHandler
2: 0x1033d7c40 v8::internal::V8::FatalProcessOutOfMemory
3: 0x103522a30 v8::internal::Heap::AllocateRawWithLightRetrySlowPath
...
11: 0x1033599d4 v8::internal::Runtime_AllocateInYoungGeneration
...
37: 0x1874c3da4 start [/usr/lib/dyld]
[1] 10191 abort ao start
All native frames resolve to /nix/store/0hwvnfndqy5jzdy05hq3rzwvbs9yask2-nodejs-slim-22.22.1/bin/node.
Impact
- Severity: High — renders
ao start unusable on the affected branch/setup
- User had to quit all running applications to recover from the memory leak
- SessionBroadcaster fetchSnapshot errors and MuxServer disconnections precede the crash, suggesting a memory leak in the SSE/WebSocket broadcasting layer
Possible Root Causes
- SessionBroadcaster snapshot polling — repeated aborted fetch operations may be leaking memory (unaborted fetches accumulating in memory)
- MuxServer connection handling — closed mux connections may not be properly cleaned up
- Next.js dev server + SSE stream — the 5s-interval SSE stream may accumulate uncollected response objects
- Node.js slim build —
nodejs-slim from Nix may have different memory management characteristics
Steps to Reproduce
- Run
ao start on branch feat/droid-agent-plugin
- Observe terminal for SessionBroadcaster/MuxServer errors
- Monitor memory usage — expect rapid growth to ~4GB
- Process aborts with OOM
Bug Report
Reporter: @yyovil
Environment: macOS, Nix-managed Node.js 22.22.1 (
nodejs-slimvia Nix store), branchfeat/droid-agent-pluginSummary
Running
ao startcauses the Next.js dev server to consume ~4GB+ of heap memory and crash with a fatal OOM error. The process aborts and the user is forced to kill all running applications to recover system memory.Crash Details
Pre-crash errors observed in terminal:
GC data (last cycles before crash):
Stack trace highlights:
v8::internal::Heap::AllocateRawWithLightRetrySlowPath)v8::internal::Runtime_AllocateInYoungGenerationBuiltins_StringSlowFlatten,Builtins_PromiseFulfillReactionJobuv__io_poll,uv_run)abort ao start— process exits with codenullFull native stack trace (37 frames):
All native frames resolve to
/nix/store/0hwvnfndqy5jzdy05hq3rzwvbs9yask2-nodejs-slim-22.22.1/bin/node.Impact
ao startunusable on the affected branch/setupPossible Root Causes
nodejs-slimfrom Nix may have different memory management characteristicsSteps to Reproduce
ao starton branchfeat/droid-agent-plugin