mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 15:24:52 +09:00
Fix listener leaks when a control connection closes (#1027)
The close handler removed the log subscription transport from the global lib logger, but updateLogSubscriptions adds it to the controller's clusterLogger. Every control connection that subscribed to logs stayed attached to clusterLogger after closing, keeping the connection alive and running every later cluster log line through its filter. handleDebugDumpWsRequest added a new debugEvents listener on each call and overwrote ws_dumper, so the close handler only removed the last one. Repeated requests stacked listeners, triggered MaxListenersExceededWarning after 11 calls, and left the earlier listeners behind. Ignore the request if the connection is already dumping. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f4aa894fe7
commit
5b63fd27fe
2 files changed
+58
-2
No files matched your search
@@ -53,7 +53,7 @@ export default class ControlConnection extends BaseConnection {
|
||||
});
|
||||
this.connector.on("close", () => {
|
||||
if (this.logTransport) {
|
||||
logger.remove(this.logTransport);
|
||||
this._controller.clusterLogger.remove(this.logTransport);
|
||||
this.logTransport = null;
|
||||
}
|
||||
if (this.ws_dumper) {
|
||||
@@ -1325,6 +1325,9 @@ export default class ControlConnection extends BaseConnection {
|
||||
}
|
||||
|
||||
async handleDebugDumpWsRequest(request: lib.DebugDumpWsRequest) {
|
||||
if (this.ws_dumper) {
|
||||
return; // Already dumping
|
||||
}
|
||||
this.ws_dumper = data => {
|
||||
if (this.connector.connected) {
|
||||
this.send(new lib.DebugWsMessageEvent(data.direction, data.content));
|
||||
|
||||
Reference in new issue
Block a user