Skip to content

No heap ceiling policy and no memory diagnostics on the bb server #4162

Description

@mattwyckhouse

Environment. bb 0.43.3 desktop, server under ELECTRON_RUN_AS_NODE=1.

Symptom. The server grows over hours and dies with
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory. Two crashes
on one host: last-resort Mark-Compact at 3251.1 (3324.6) -> 3251.1 MB after 11 h uptime and at
3038.2 (3192.8) -> 3038.0 MB after 42.75 h. Nothing warns first, and there is no endpoint to read
heap size, heap-space statistics or take a snapshot. (v8.getHeapStatistics().heap_size_limit on
this Electron build is 4,192 MB and cannot be raised; --max-old-space-size above it is ignored.)

Evidence. The launcher spawns the server with no execArgv
(packages/bb-app/src/launcher.ts: spawn(process.execPath, [runtime.context.serverEntry], { cwd, env, stdio }))
and the desktop side only adds ELECTRON_RUN_AS_NODE=1 (apps/desktop/src/bb-process.ts).
Neither tree nor the installed dist/*.js contains max-old-space-size, NODE_OPTIONS,
getHeapStatistics, writeHeapSnapshot, memoryUsage() or an inspector hook.

Proposed fix. GET /api/v1/system/diagnostics returning process.memoryUsage(),
v8.getHeapStatistics(), v8.getHeapSpaceStatistics(), per-plugin load-generation counts and
cache sizes; an explicit heap ceiling with a logged warning at, say, 70 % and 85 %; and a
documented graceful-restart path. A sampling heap profiler endpoint (HeapProfiler.startSampling)
would name retainers without the stop-the-world cost of a full snapshot.


Filed from an audit of bb 0.43.3 by the Factory plugin (github.com/mattwyckhouse/bb-plugin-factory). Method, re-derived numbers and the adversarial review of this report: plans/076-host-sustainable-line/bb-core-issues/REVIEW.md in that repository.

Activity

  1. added
    host
    on Sep 23, 2026
  2. bb-slop-cop commented on Sep 23, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Applied Type Feature, Priority High, Effort High, and labels host, perf. No existing classification values were present.

    The requested diagnostics APIs and heap-management policy add functionality. Reported crashes warrant High priority; API and policy design warrant High effort. Final Type verified as Feature, so reproduction and fix steps were skipped. No PR opened because this requires product and API design decisions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    hostperf

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions