fix(daemon): defer probeCancel so a panic mid-diagnostic still releases ctx
DetectHWAccelDiagnostic spawns subprocess calls; an unexpected panic (broken ffmpeg binary, OOM mid-exec) would otherwise leave the WithTimeout context dangling until natural expiry. defer keeps the goroutine + timer reachable until runDaemonStart returns, but on a long-lived daemon that's the process lifetime anyway — same effective cost, with the safety guarantee.
This commit is contained in:
parent
e3d38791d3
commit
4f304fb13a
1 changed files with 1 additions and 1 deletions
|
|
@ -152,8 +152,8 @@ func runDaemonStart() error {
|
|||
// startup forever.
|
||||
ffmpegResolved, _ := mediainfo.ResolveFFmpeg(cfg.Library.FFmpegPath)
|
||||
probeCtx, probeCancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer probeCancel() // guard against a panic inside DetectHWAccelDiagnostic
|
||||
hwDiag := engine.DetectHWAccelDiagnostic(probeCtx, ffmpegResolved)
|
||||
probeCancel()
|
||||
log.Println(hwDiag.LogLine())
|
||||
hwAccelPick := hwDiag.Pick
|
||||
maxTranscodeHeight := 1080
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue