You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rpc: client leaks pending promises forever when postMessage throws (terminate window, dead thread) #397
packages/opencode/src/util/rpc.ts:112-113: call() does pending.set(id,{resolve,reject}) then target.postMessage(...) with no try/catch. WorkerPostMessageTarget.postMessage (worker-process.ts:154, if(!current) throw) and the thread-worker path (:268-269, postMessage after terminate/thread death) throw synchronously. The pending entry is never removed nor rejected; target.onclose only runs after process exit, so the caller hangs forever. Headless run.ts awaits background.wait that never resolves; the TUI's createWorkerFetch hangs - looks like a freeze.
Repro:await worker.terminate() then client.call("fetch", ...), or fire a request in the crash-restart window when current===undefined; the pending Map grows and the promise never settles. Fix size: small (try/catch around postMessage; on throw pending.delete(id); reject(error)).
Activity
fix: settle rpc calls when postMessage throws instead of leaking them (…
agenteinstinct1-max commentedon Oct 21, 2026
Fixed by #446 (merged into dev-vibecoded).