Server dies with V8 heap OOM (SIGABRT) while session warming is active

未关闭
#65,371 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
领域
performance

调研方向

Start by reading the gist timeline to confirm the heap ratchet lines up with each warming cycle, then open packages/core/src/plugin/warming.ts and trace what a warming pass retains after it returns — the reporter points at the full session context being rebuilt and not persisted. Reproduce with "warming": true on a build matching 2.3.2 and take heap snapshots across two or three cycles (e.g. via the server's inspect port) to see whether the growth is in warming itself or in the reply path it triggers. Done looks like a demonstrated retention point plus either a fix or a size/throttle change to the warming interval, with the gist's RSS pattern no longer reproducing.

由索引模型根据 Issue 内容生成。

描述

area/plugins platform/linux type/bug version/v2

Description

OpenCode server v2.3.2 with "warming": true in opencode.json died with a JavaScript heap OOM four times today (2026-11-21, at 17:13 / 17:38 / 18:01 / 18:33), each time while a reply was generating (busySessionCount 1 / 1 / 2 / 2). With no user activity the server heap floors at ~2 GB and peaks at 4.3–4.7 GB; smaps at the peak is ~97% anonymous private dirty (Rss 4,060,184 kB, Pss_Anon 3,949,200 kB, Pss_File 18,009 kB), so it is V8 heap, not file cache.

Log correlation: warming session and scheduled session warming (interval="240000 millis") entries run every ~4 minutes across 10+ sessions, all day, every day. The session that was mid-reply at the 18:01 crash had warming generations at 17:49:15 / 17:53:15 / 17:57:15 / 18:01:15 and died 36 seconds after the last one. The same warming load ran from 11-11 to 11-20 with zero crashes; the crashes started the day after I upgraded the CLI to 2.3.2 and the desktop app that bundles the server. I cannot prove that upgrade is the trigger (no old builds left to A/B), but the growth tracks the warming cadence exactly: after each restart the heap starts at 0.15–0.84 GB and ratchets up with every warming cycle until it dies 24–32 minutes later.

My guess is packages/core/src/plugin/warming.ts: each cycle re-sends the full session context, the reply is not persisted, and the heap only grows. The crashing session had 26 messages, so it is not a "session got too big" spiral.

After I removed "warming" from the config (~18:36), the same server stopped ratcheting: RSS sawtooths 0.4–2 GB on real requests but returns to a ~0.85 GB floor. Only ~10 minutes of post-change data so far; monitoring continues.

Ruled out: kernel OOM killer, manual restart, config reload, and a second opencode serve --service on the same machine (that one stayed healthy for over a day; I did not check whether warming was active in it).

Evidence (unlisted gist): journal excerpts of the four restart diagnostics, the 1 Hz RSS curve with per-epoch floors/peaks, smaps_rollup at the peak, and the warming log timeline — https://gist.github.com/MorningStar0709/c8e53eb59286765144e202f2f6c6d9b8

Plugins: session warming (core, enabled via config). The same server process also loads billion-context, @openchamber/opencode-search-providers and two local plugins; I list them for completeness — the growth pattern (ratchet between warming cycles, sawtooth otherwise) points at warming.

OpenCode version: 2.3.2 — the server binary is the one bundled by the OpenChamber 2.7.3 desktop app; not reproduced with a standalone CLI-launched server.

Steps to reproduce

  1. "warming": true in opencode.json
  2. Let a few sessions be warmed (or just leave them idle)
  3. Within about an hour the server dies: FATAL ERROR: ... Allocation failed - JavaScript heap out of memory

OS: Linux

Terminal: none (server process, no TTY)

Questions: is this a known issue? Could warming skip or throttle sessions with large contexts, or free the per-cycle context afterwards? A size-aware interval would also help (core has a global warming.interval; openchamber/openchamber#5955 asks for a per-session one).

主要语言
TypeScript
星标
227k
派生
30.7k
平均合并
3 小时 57 分钟
30 天内合并 PR
484

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。