copilot-emacs / copilot.el

An unofficial Copilot plugin for Emacs.
MIT License
1.71k stars 122 forks source link

Copilot MaxListenersExceededWarning, stops working #282

Open DylanModesitt opened 3 months ago

DylanModesitt commented 3 months ago

After 5-10 minutes of using copilot.el, it stops working entirely. copilot-diagnose will bring it back (but only for a few minutes). A few colleagues of mine also experience the same issue. copilot-events shows

[stderr] 
[stderr] 
[stderr] nil
[stderr] nil
[stderr] Process copilot agent stderr finished
[stderr] 
[stderr] 
[stderr] nil
[stderr] nil
[stderr] Process copilot agent stderr<1> finished
[stderr] (node:61689) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 change listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit
[stderr] (Use `node --trace-warnings ...` to show where the warning was created)

----------b---y---e---b---y---e----------

I have seen the same issue mentioned here in reference to copilot.vim. Perhaps this is also related to the many seeming to experience #181? My version of node is 21.7.1, npm is at 10.5.0, I am on GNU Emacs 29.2 (build 1, aarch64-apple-darwin21.6.0, NS appkit-2113.60 Version 12.6.6 (Build 21G646)) of 2024-01-18. I have run copilot-reinstall-server (no effect). Happy to provide any additional details that might be helpful.

chep commented 2 months ago

Hi, I'm experiencing the same issue, but only for rustic-mode. Copilot works fine for C,C++ or elisp modes. I don't know what to do to help but if I can, feel free to ask. If you tell me what you need, I can can give you backtraces, logs or whatever.

I added --trace-warnings :

[stderr]  (node:3751) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 change listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit
[stderr]      at genericNodeError (node:internal/errors:984:15)
[stderr]      at wrappedFn (node:internal/errors:538:14)
[stderr]      at _addListener (node:events:593:17)
[stderr]      at EventEmitter.addListener (node:events:611:10)
[stderr]      at YZ.onDidChangeTextDocument (/home/chep/.emacs.d/.cache/copilot/lib/node_modules/copilot-node-server/copilot/dist/agent.js:628:39989)
[stderr]      at new ChangeTracker (/home/chep/.emacs.d/.cache/copilot/lib/node_modules/copilot-node-server/copilot/dist/agent.js:628:2102)
[stderr]      at postInsertionTasks (/home/chep/.emacs.d/.cache/copilot/lib/node_modules/copilot-node-server/copilot/dist/agent.js:628:5206)
[stderr]      at notifyAcceptedChecked (/home/chep/.emacs.d/.cache/copilot/lib/node_modules/copilot-node-server/copilot/dist/agent.js:628:7508)
[stderr]      at /home/chep/.emacs.d/.cache/copilot/lib/node_modules/copilot-node-server/copilot/dist/agent.js:566:1932
[stderr]      at VZ.messageHandler (/home/chep/.emacs.d/.cache/copilot/lib/node_modules/copilot-node-server/copilot/dist/agent.js:628:38295)