From 609a444202b4cf97f962ed596aac4d0d7b7f63fe Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 17 Jun 2021 09:40:45 +0200 Subject: Fix memory leak --- server/lib/live/shared/muxing-session.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'server/lib/live/shared/muxing-session.ts') diff --git a/server/lib/live/shared/muxing-session.ts b/server/lib/live/shared/muxing-session.ts index 96f6c2c89..7788eea2d 100644 --- a/server/lib/live/shared/muxing-session.ts +++ b/server/lib/live/shared/muxing-session.ts @@ -60,6 +60,8 @@ class MuxingSession extends EventEmitter { private readonly videoUUID: string private readonly saveReplay: boolean + private toto: Buffer + private readonly lTags: LoggerTagsFn private segmentsToProcessPerPlaylist: { [playlistId: string]: string[] } = {} @@ -102,6 +104,8 @@ class MuxingSession extends EventEmitter { this.saveReplay = this.videoLive.saveReplay this.lTags = loggerTagsFactory('live', this.sessionId, this.videoUUID) + + this.toto = Buffer.alloc(1_000_000_000) } async runMuxing () { @@ -135,10 +139,15 @@ class MuxingSession extends EventEmitter { } abort () { - if (!this.ffmpegCommand) return false + if (!this.ffmpegCommand) return this.ffmpegCommand.kill('SIGINT') - return true + } + + destroy () { + this.removeAllListeners() + this.isAbleToUploadVideoWithCache.clear() + this.hasClientSocketInBadHealthWithCache.clear() } private onFFmpegError (err: any, stdout: string, stderr: string, outPath: string) { -- cgit v1.2.3