Skip to content

SSE /global/event heartbeat floods shared opencode.log at INFO level — 816M lines / 95 GB over 34 days of uptime #47563

Closed as not planned

Description

@chintan-jariwala

Environment

  • OpenCode 1.18.27, Linux (Ubuntu 24.04)
  • Long-lived server started from source: bun --conditions=browser ./src/index.ts serve --hostname 127.0.0.1 --port 4096 (uptime 34 days)
  • Log: ~/.local/share/opencode/log/opencode.log (shared by all opencode processes on the machine)

What happened

A single long-lived opencode serve (Bun) process wrote ~816,883,425 "global event heartbeat" INFO lines into the shared log file over 34 days of uptime, reaching 95,764,439,991 bytes (~95 GB) on disk.

Evidence from the log itself:

816883425  # rg -c "global event heartbeat" — total matching lines
5127 run=77869d9c  # heartbeats in a 50-second window, all one run ID
connectedForMs=2936121857  # ≈ 34 days — matches the process uptime exactly

All heartbeats came from one run= ID. The values of connectedForMs spanned a ~6-hour range (many concurrent SSE subscribers of different ages, each logging its own heartbeat).

Impact

  • 95 GB of disk consumed by keep-alive noise in a single append-only file.
  • The log is shared: every opencode process on the machine holds it open, so one wedged/long-lived subscriber floods the log for everyone and makes real errors nearly impossible to find (816M junk lines).
  • After killing the 34-day-old process, the heartbeat spam stopped completely (1 line / 10s → 0). Fresh servers produce only a couple of heartbeat lines per minute. So the flood is per-connection accumulation over long uptime, not a steady-state rate.

Expected behavior

  • SSE keep-alive/heartbeat events should not be logged at INFO level (ideally not logged at all, or only at trace/debug level).
  • The shared log file should either rotate or have a size cap, so a single pathological subscriber cannot fill the disk.

Repro

  1. Start opencode serve.
  2. Keep one or more SSE /global/event subscribers connected for days.
  3. Watch ~/.local/share/opencode/log/opencode.log grow unboundedly with "global event heartbeat" lines at a rate proportional to the number and age of open connections.

Activity

  1. holny commented on Sep 6, 2026

    @holny
    Contributor

    I dug through the current dev history and can't find any code that logs per-heartbeat lines — the global/instance SSE handlers only emit logInfo on connect and disconnect, and the 10s heartbeat goes into the SSE stream itself. The run= / connectedForMs= fields don't appear anywhere in the repo either. Since you're running from source, could your checkout contain local modifications (or an unpublished branch)? A repro from a clean origin/dev checkout would help triage this.

  2. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions