Skip to content

MaxListenersExceededWarning: Possible EventTarget memory leak detected in effect/Evaluate #37835

Description

@zhoumoxingqt-cmd

Description

What happened?
While using OpenCode, I encountered a MaxListenersExceededWarning indicating that 11 event listeners were added to an EventEmitter (identified as yZ), exceeding the default limit of 10. The warning suggests a potential memory leak.

The stack trace points to internal effect evaluation (~effect/Effect/evaluate) and run-loop logic, which appears to be part of OpenCode's reactivity system.

Full warning:

text
MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 event listeners added to [yZ]. MaxListeners is undefined. Use events.setMaxListeners() to increase limit
at overflowWarning (node:events:185:19)
at addListener (node:events:158:22)
at ~effect/Effect/evaluate (/$bunfs/root/chunk-xvx3wx9t.js:25:4492)
at runLoop (/$bunfs/root/chunk-xvx3wx9t.js:25:2045)
at evaluate (/$bunfs/root/chunk-xvx3wx9t.js:25:1435)
at runTasks (/$bunfs/root/chunk-xvx3wx9t.js:11:12750)
at afterScheduled (/$bunfs/root/chunk-xvx3wx9t.js:11:12637)
The emitter object shows _maxListeners: undefined, which uses the default limit of 10.

Plugins

Please list any plugins you have enabled: (I'm not using any third-party plugins; this is a vanilla OpenCode installation.)

OpenCode version

No response

Steps to reproduce

Start OpenCode (version unspecified).

Perform actions that trigger reactive updates – in my case, the warning appeared during normal usage (e.g., editing a file, running a command, or switching contexts).

Observe the warning in the terminal/console after repeated interactions.

(I haven't isolated a minimal reproducible case yet, but the warning occurs consistently under load.)

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions