anomalyco / anomalyco/opencode

Intermittent hang at 'booting location services': silent idle, no CPU/net; headless repro (resume existing session); references #35870/#41934

Open
#48,669 0 comments 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Sep 12, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Environment
  • opencode 1.18.30 (latest at 2026-09-12), Linux x86_64, latest channel
  • Effect @effect/... 4.0.0-beta.83 (per the root cause described in #35870)
Symptom

Startup intermittently hangs at the "booting location services" phase:

  1. Phase 1 (load/config/init) completes fast (~2-5s, all LSPs / init count logged).
  2. booting location services is logged, then the log goes completely silent and the
    process idles: main thread in epoll_wait/cond-wait, 0% CPU, no disk, no sockets.
  3. The session is never created (created id=... never logs). Hangs I captured lasted
    150s, 173s, 1519s and "forever" (killed by watchdog).

It is intermittent: the same command in the same directory alternates between completing
the location boot in under a second and hanging for minutes.

Empirical isolations (all reproduced headlessly, no TUI involved)
  • Reproduces in a fresh scratch dir with an empty opencode.json (no plugins, no
    project config) => not plugin/provider/cwd related. opencode run -c ... (fresh session)
    and opencode run --session <existing-session> -c ... are both affected.
  • With HTTP_PROXY/HTTPS_PROXY/ALL_PROXY pointed at a 502-returning logging CONNECT proxy,
    the boot still hangs with ZERO sockets open => the stall is a local effect await,
    not a network egress issue.
  • SQLite (memory.db) IMMEDIATE lock acquired instantly during a hang => not a DB lock.
  • 16/16 cold boots completed (3-23s) under pure CPU load (4x yes), but hangs are
    provoked by parallel cold boots (2-4 concurrent opencode instances / the TUI
    booting an existing project dir eagerly) - matching #35870's "scheduler/memory pressure".
  • opencode serve + POST /session boots lazily and creates a session in ~5s without
    hanging; the interactive TUI (and run --session) creates/attaches its location eagerly
    at startup, which is the path that strands.
Repro
# 1) create a session quickly
opencode run --dir /tmp/ocr-repro -c "hi" --print-logs   # fast; note the session id
# 2) resume it (this routes through the eager location boot that intermittently hangs)
for i in $(seq 1 10); do
  opencode run --dir /tmp/ocr-repro --session <id> -c "hi" --print-logs &
done

A fraction of the instances stall right after booting location services with a silent
log and no session created; they must be killed. Kill + retry makes the same command
complete fine.

References
  • #35870 (same root cause: InstanceStore.load boot Deferred + effect beta.83 runLoop
    re-entrancy guard -> lost wakeup). This issue adds a headless repro + "not network /
    not plugins / not DB" isolation and the --session eager-location-boot trigger.
  • #41934 (unguarded Npm.install/arborist reify also stalls startup when the registry
    is slow; observed as a separate first-phase delay of 12-120s on the npm-plugin config).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.