mirror of https://github.com/Chocobozzz/PeerTube
Fix memory leak
parent
c6406f4750
commit
609a444202
|
@ -159,7 +159,12 @@ class LiveManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
const muxingSession = this.muxingSessions.get(sessionId)
|
const muxingSession = this.muxingSessions.get(sessionId)
|
||||||
if (muxingSession) muxingSession.abort()
|
if (muxingSession) {
|
||||||
|
muxingSession.abort()
|
||||||
|
muxingSession.destroy()
|
||||||
|
|
||||||
|
this.muxingSessions.delete(sessionId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleSession (sessionId: string, streamPath: string, streamKey: string) {
|
private async handleSession (sessionId: string, streamPath: string, streamKey: string) {
|
||||||
|
@ -269,6 +274,8 @@ class LiveManager {
|
||||||
muxingSession.on('after-cleanup', ({ videoId }) => {
|
muxingSession.on('after-cleanup', ({ videoId }) => {
|
||||||
this.muxingSessions.delete(sessionId)
|
this.muxingSessions.delete(sessionId)
|
||||||
|
|
||||||
|
muxingSession.destroy()
|
||||||
|
|
||||||
return this.onAfterMuxingCleanup(videoId)
|
return this.onAfterMuxingCleanup(videoId)
|
||||||
.catch(err => logger.error('Error in end transmuxing.', { err, ...localLTags }))
|
.catch(err => logger.error('Error in end transmuxing.', { err, ...localLTags }))
|
||||||
})
|
})
|
||||||
|
|
|
@ -60,6 +60,8 @@ class MuxingSession extends EventEmitter {
|
||||||
private readonly videoUUID: string
|
private readonly videoUUID: string
|
||||||
private readonly saveReplay: boolean
|
private readonly saveReplay: boolean
|
||||||
|
|
||||||
|
private toto: Buffer
|
||||||
|
|
||||||
private readonly lTags: LoggerTagsFn
|
private readonly lTags: LoggerTagsFn
|
||||||
|
|
||||||
private segmentsToProcessPerPlaylist: { [playlistId: string]: string[] } = {}
|
private segmentsToProcessPerPlaylist: { [playlistId: string]: string[] } = {}
|
||||||
|
@ -102,6 +104,8 @@ class MuxingSession extends EventEmitter {
|
||||||
this.saveReplay = this.videoLive.saveReplay
|
this.saveReplay = this.videoLive.saveReplay
|
||||||
|
|
||||||
this.lTags = loggerTagsFactory('live', this.sessionId, this.videoUUID)
|
this.lTags = loggerTagsFactory('live', this.sessionId, this.videoUUID)
|
||||||
|
|
||||||
|
this.toto = Buffer.alloc(1_000_000_000)
|
||||||
}
|
}
|
||||||
|
|
||||||
async runMuxing () {
|
async runMuxing () {
|
||||||
|
@ -135,10 +139,15 @@ class MuxingSession extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
abort () {
|
abort () {
|
||||||
if (!this.ffmpegCommand) return false
|
if (!this.ffmpegCommand) return
|
||||||
|
|
||||||
this.ffmpegCommand.kill('SIGINT')
|
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) {
|
private onFFmpegError (err: any, stdout: string, stderr: string, outPath: string) {
|
||||||
|
|
Loading…
Reference in New Issue