Skip to content

1.4.0 memory leak. Bun occupies more than 3g memory at most. #21430

Closed as not planned

Description

@nUser0

Description

opencode-cli.exe web --hostname 192.168.1.25 --port 4095

After running for a period of time, cmd displays the following error message:

MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 event listeners added to [EventEmitter]. MaxListeners is undefined. Use events.setMaxListeners() to increase limit
emitter: EventEmitter {
_events: [Object ...],
_eventsCount: 1,
_maxListeners: undefined,
[Symbol(kCapture)]: false,
setMaxListeners: [Function: setMaxListeners],
getMaxListeners: [Function: getMaxListeners],
emit: [Function: emit],
addListener: [Function: addListener],
on: [Function: addListener],
prependListener: [Function: prependListener],
once: [Function: once],
prependOnceListener: [Function: prependOnceListener],
removeListener: [Function: removeListener],
off: [Function: removeListener],
removeAllListeners: [Function: removeAllListeners],
listeners: [Function: listeners],
rawListeners: [Function: rawListeners],
listenerCount: [Function: listenerCount],
eventNames: [Function: eventNames],
},
type: "event",
count: 11,

  at overflowWarning (node:events:185:19)
  at addListener (node:events:158:22)
  at <anonymous> (B:/~BUN/root/src/index.js:400384:19)
  at <anonymous> (B:/~BUN/root/src/index.js:400308:29)
  at <anonymous> (B:/~BUN/root/src/index.js:397188:13)
  at streamSSE (B:/~BUN/root/src/index.js:397217:7)
  at streamEvents (B:/~BUN/root/src/index.js:400282:19)
  at <anonymous> (B:/~BUN/root/src/index.js:400380:24)
  at dispatch (B:/~BUN/root/src/index.js:392956:30)
  at <anonymous> (B:/~BUN/root/src/index.js:392874:16)
  at dispatch (B:/~BUN/root/src/index.js:392956:30)
  at dispatch (B:/~BUN/root/src/index.js:392956:30)
  at cors2 (B:/~BUN/root/src/index.js:394447:16)
  at async dispatch (B:/~BUN/root/src/index.js:392956:30)
  at async <anonymous> (B:/~BUN/root/src/index.js:404053:20)
  at async dispatch (B:/~BUN/root/src/index.js:392956:30)
  at async basicAuth22 (B:/~BUN/root/src/index.js:394521:24)
  at async dispatch (B:/~BUN/root/src/index.js:392956:30)
  at async <anonymous> (B:/~BUN/root/src/index.js:393581:40)

Plugins

none

OpenCode version

1.4.0

Steps to reproduce

opencode-cli.exe web --hostname 192.168.1.25 --port 4095
After a period of normal use.
cmd displays the error message.

Screenshot and/or share link

No response

Operating System

win11

Terminal

cmd

Activity

  1. added
    perfIndicates a performance issue or need for optimization
    webRelates to opencode on web / desktop
    on Apr 8, 2026
  2. github-actions commented on Apr 8, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    • Memory Megathread #20695: Memory Megathread — the maintainers are actively tracking memory issues here and have instructions on how to collect heap snapshots to help diagnose the problem. Please consider contributing your findings there.
  3. jeremyakers commented on Apr 13, 2026

    @jeremyakers

    Same issue for me as well. This is happening to me constantly after updating to 1.4.x

    Image
  4. GuoChen-thlg commented on Apr 13, 2026

    @GuoChen-thlg

    MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 event listeners added to [EventEmitter]. MaxListeners is undefined. Use events.setMaxListeners() to increase limit
    emitter: EventEmitter {
    _events: [Object ...],
    _eventsCount: 1,
    _maxListeners: undefined,
    [Symbol(kCapture)]: false,
    setMaxListeners: [Function: setMaxListeners],
    getMaxListeners: [Function: getMaxListeners],
    emit: [Function: emit],
    addListener: [Function: addListener],
    on: [Function: addListener],
    prependListener: [Function: prependListener],
    once: [Function: once],
    prependOnceListener: [Function: prependOnceListener],
    removeListener: [Function: removeListener],
    off: [Function: removeListener],
    removeAllListeners: [Function: removeAllListeners],
    listeners: [Function: listeners],
    rawListeners: [Function: rawListeners],
    listenerCount: [Function: listenerCount],
    eventNames: [Function: eventNames],
    },
    type: "event",
    count: 11,

      at overflowWarning (node:events:185:19)
      at addListener (node:events:158:22)
      at <anonymous> (/$bunfs/root/src/index.js:405906:19)
      at <anonymous> (/$bunfs/root/src/index.js:405830:29)
      at <anonymous> (/$bunfs/root/src/index.js:402641:13)
      at streamSSE (/$bunfs/root/src/index.js:402670:7)
      at streamEvents (/$bunfs/root/src/index.js:405804:19)
      at <anonymous> (/$bunfs/root/src/index.js:405902:24)
      at dispatch (/$bunfs/root/src/index.js:399067:30)
      at <anonymous> (/$bunfs/root/src/index.js:398985:16)
      at dispatch (/$bunfs/root/src/index.js:399067:30)
      at dispatch (/$bunfs/root/src/index.js:399067:30)
      at cors2 (/$bunfs/root/src/index.js:400749:16)
      at async dispatch (/$bunfs/root/src/index.js:399067:30)
      at async <anonymous> (/$bunfs/root/src/index.js:410107:20)
      at async dispatch (/$bunfs/root/src/index.js:399067:30)
      at async dispatch (/$bunfs/root/src/index.js:399067:30)
      at async <anonymous> (/$bunfs/root/src/index.js:399692:40)
    
  5. dinogon commented on Apr 14, 2026

    @dinogon

    Me too.

  6. XiaOldMan commented on Apr 14, 2026

    @XiaOldMan

    MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 event listeners added to [EventEmitter]. MaxListeners is undefined. Use events.setMaxListeners() to increase limit
    emitter: EventEmitter {
    _events: [Object ...],
    _eventsCount: 1,
    _maxListeners: undefined,
    [Symbol(kCapture)]: false,
    setMaxListeners: [Function: setMaxListeners],
    getMaxListeners: [Function: getMaxListeners],
    emit: [Function: emit],
    addListener: [Function: addListener],
    on: [Function: addListener],
    prependListener: [Function: prependListener],
    once: [Function: once],
    prependOnceListener: [Function: prependOnceListener],
    removeListener: [Function: removeListener],
    off: [Function: removeListener],
    removeAllListeners: [Function: removeAllListeners],
    listeners: [Function: listeners],
    rawListeners: [Function: rawListeners],
    listenerCount: [Function: listenerCount],
    eventNames: [Function: eventNames],
    },
    type: "event",
    count: 11,

      at overflowWarning (node:events:185:14)
      at addListener (node:events:158:22)
      at <anonymous> (/$bunfs/root/src/index.js:405957:19)
      at <anonymous> (/$bunfs/root/src/index.js:405881:29)
      at <anonymous> (/$bunfs/root/src/index.js:363267:13)
      at streamSSE (/$bunfs/root/src/index.js:363296:7)
      at streamEvents (/$bunfs/root/src/index.js:405855:19)
      at <anonymous> (/$bunfs/root/src/index.js:405953:24)
      at dispatch (/$bunfs/root/src/index.js:348752:30)
      at <anonymous> (/$bunfs/root/src/index.js:348670:16)
      at dispatch (/$bunfs/root/src/index.js:348752:30)
      at dispatch (/$bunfs/root/src/index.js:348752:30)
      at cors2 (/$bunfs/root/src/index.js:350434:16)
      at async dispatch (/$bunfs/root/src/index.js:348752:30)
      at async <anonymous> (/$bunfs/root/src/index.js:410158:20)
      at async dispatch (/$bunfs/root/src/index.js:348752:30)
      at async dispatch (/$bunfs/root/src/index.js:348752:30)
      at async <anonymous> (/$bunfs/root/src/index.js:349377:40)
    

    已杀死

  7. removed
    bugSomething isn't working
    perfIndicates a performance issue or need for optimization
    webRelates to opencode on web / desktop
    on May 3, 2026
  8. github-actions commented on Jul 6, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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