-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MaxListenersExceededWarning when using the Cloud logs viewer #4186
Comments
@eysi09 is this still reproducible? |
I still see this, don’t have a proper repro atm |
Ok, thanks! We'll move it to the backlog then. |
Found the issue and have a repro: When requesting a command via ws, a bunch of listeners subscribe to the Garden event bus that are never cleaned up. So simply by using the Clouds logs viewer or command palette, the subscribers pile up until they eventually exceed the limit. So the solution is to figure out a way to unsubscribe the subscribers that got created during the command run for the requested command, but not others, which may still be needed. |
User @ralphv had this issue in Discord when running a task that exports outputs from a DB https://discord.com/channels/817392104711651328/1106250635931811981/1106250635931811981 |
Seems related to node-fetch/node-fetch#1295 |
Thank @ShankyJS! And a brief update after some more investigation:
Re-assigning to @thsig who's been looking into the former cause. |
Closes #4186. Before this fix, we weren't removing event listeners registered by the plugin event brokers (mostly for the `_exit` and `_restart` control events). This is now done in a simple way via the new `onKey` and `clearKey` methods on the event bus, which facilitates removing all listeners matching a given key. We use `garden.sessionId` as the key now, which is not quite ideal when running concurrent commands in `garden dev`, but we'll be assigning a command-unique `sessionId` in an upcoming PR (which gives us precisely the semantics we want here).
Closes #4186. Before this fix, we weren't removing event listeners registered by the plugin event brokers (mostly for the `_exit` and `_restart` control events). This is now done in a simple way via the new `onKey` and `clearKey` methods on the event bus, which facilitates removing all listeners matching a given key. We use `garden.sessionId` as the key now, which is not quite ideal when running concurrent commands in `garden dev`, but we'll be assigning a command-unique `sessionId` in an upcoming PR (which gives us precisely the semantics we want here).
Closed by #4258. |
Here's the full error:
(node:23396) MaxListenersExceededWarning: (node) warning: possible EventEmitter memory leak detected. 1001 listeners added. Use emitter.setMaxListeners() to increase limit.
This happens when running the Garden serve command and connecting via Cloud.
Might be due to this: https://discord.com/channels/817392104711651328/1102901553544822885
The text was updated successfully, but these errors were encountered: