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
Log cleanup threshold & Bus subscription memory leak #17185
Log cleanup threshold (src/util/log.ts): Fixed inconsistent threshold check - was checking files.length <= 5 but keeping last 10 files with slice. Changed to files.length <= 10 to match the slice logic.
Bus subscription memory leak (src/bus/index.ts): When all subscribers for an event type unsubscribed, the empty array remained in the subscriptions Map. Added cleanup to delete the key when the array becomes empty.
This appears to describe fixes/patches already made rather than reporting bugs with steps to reproduce. A bug report should describe the problem you observed, not the solution.
Required fields are left as _No response_: OpenCode version, Steps to reproduce, Operating System, and Terminal. Please fill in at least the version and reproduction steps so maintainers can verify the reported behavior.
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
We identified a similar Bus subscription leak pattern in our investigation of WebKit-based runtimes.
Our Finding
In Bun runtime, we found that event subscriptions created but never unsubscribed hold references to closures, preventing GC. This matches your fix in src/bus/index.ts.
Related Leaks Found
We identified 4 JSC GC leaks total:
HashTable iterator invalidation during GC
Vector assignment during parallel marking
SlotVisitor::drainFromShared race condition
AST node leaks (for-of destructuring)
Cross-Project Coordination
This appears to be a WebKit JavaScriptCore upstream issue affecting multiple projects:
Activity
github-actions commentedon Mar 12, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
_No response_: OpenCode version, Steps to reproduce, Operating System, and Terminal. Please fill in at least the version and reproduction steps so maintainers can verify the reported behavior.Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
src/util/log.ts(thefiles.length <= 5vsslice(0, -10)inconsistency) with detailed analysis and reproduction steps.If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Mar 12, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.
jnorthrup commentedon Mar 21, 2026
Related: Bus Subscription Memory Leak Pattern
We identified a similar Bus subscription leak pattern in our investigation of WebKit-based runtimes.
Our Finding
In Bun runtime, we found that event subscriptions created but never unsubscribed hold references to closures, preventing GC. This matches your fix in src/bus/index.ts.
Related Leaks Found
We identified 4 JSC GC leaks total:
Cross-Project Coordination
This appears to be a WebKit JavaScriptCore upstream issue affecting multiple projects:
Upstream References
Would your Bus subscription fix help other embedders? Consider upstreaming to WebKit.
jnorthrup commentedon Mar 21, 2026
We found this issue through our investigation of WebKit JavaScriptCore memory leaks across multiple projects (Bun, Claude Code, OpenCode).
Why This Matters
This issue contained:
But was closed by github-actions bot for:
Hardware Risk Ignored
Memory leaks on Apple Silicon Macs can cause:
Cross-Project Pattern
We found the same auto-closure pattern affecting:
opencode serveto multi-GB memory #17837 - Multi-GB sidebar prefetch leak (closed by bot)Our Related Investigation
Bun team identified 4 JSC GC leaks:
JSC::SlotVisitor::drainFromSharedrace (7,214 frames)WTF::HashTable::removeIterator(7,214 frames)WTF::Vector<>::operator=(7,220 frames)JSC::ASTBuilder::createForOfLoop(713 frames)All point to WebKit upstream GC issue affecting all embedders.
Recommendation
For anomalyco/opencode maintainers:
perfandbuglabelsThis is a hardware safety issue, not a formatting problem.
Related:
jnorthrup commentedon Mar 21, 2026
🚨 URGENT: Cross-Project Memory Leak Crisis - Hardware Damage Risk
We investigated memory leaks across WebKit-based runtimes (Bun, Claude Code, OpenCode) and found a critical pattern affecting all embedders.
Hardware Risk Statement
On Apple Silicon Macs:
On Linux servers:
Our Investigation Findings
Bun Runtime (WebKit JSC):
JSC::SlotVisitor::drainFromSharedrace condition (7,214 frames)WTF::HashTable::removeIterator(7,214 frames)WTF::Vector<>::operator=(7,220 frames)JSC::ASTBuilder::createForOfLoop(713 frames)OpenCode (from your issues):
Common Root Cause
WebKit JavaScriptCore parallel GC marking phase:
SlotVisitor::drainFromSharedUpstream References
Tool We Built
We created an ASAN tracker (760 lines of Zig) that:
Happy to share this tool with OpenCode maintainers.
Urgency: Auto-Close Bot Pattern
We observed issues #17837 and #17185 were closed by github-actions bot within 2 hours for "contributing guidelines" - despite containing:
This pattern is dangerous for memory safety issues:
Recommended Actions
Immediate:
perfandbuglabelsShort-term:
Long-term:
Cross-Project Coordination
We're coordinating with:
Memory leaks don't respect project boundaries - this is an ecosystem-wide crisis.
Evidence:
Please prioritize this over formatting requirements.