Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

NodeJS process crash when killing ffmpeg instance #861

Open
@Ekliptor

Description

@Ekliptor

I am using ffmpeg for screenshot generation and video transcoding on many servers. Sometimes a task doesn't finish, so I added a code to abort it using setTimeout()

let commandObj = FfmpegCommand(..);
setTimeout(() => {
     commandObj.kill("SIGKILL");
}, 10000);

This works 99% of the time, however sometimes I get crashes with stacktraces telling me that stdErr is undefined

TypeError: Cannot read property 'get' of undefined", "    
at endCB (/home/staydown/nodejs/SD_Inspector/SpiderManager/node_modules/fluent-ffmpeg/lib/processor.js:544:37)", "    
at ChildProcess.<anonymous> (/home/staydown/nodejs/SD_Inspector/SpiderManager/node_modules/fluent-ffmpeg/lib/processor.js:159:9)", "    
at ChildProcess.emit (events.js:182:13)", "    
at Process.ChildProcess._handle.onexit (internal/child_process.js:235:12)", "    
at onErrorNT (internal/child_process.js:406:16)", "    at process._tickCallback (internal/process/next_tick.js:63:19)"

Since the lines above 159 already check for process exit, I suggest adding a check if stdErr is undefined or a try-catch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions