bluenviron / mediamtx

Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams.
MIT License
10.74k stars 1.4k forks source link

MediaMTX crashes after enabling recording on path with source on demand #3246

Closed mfurmanit closed 2 months ago

mfurmanit commented 2 months ago

Which version are you using?

v1.7.0

Which operating system are you using?

Describe the issue

MediaMTX crashes after sending PATCH request that enables recording for path with sourceOnDemand true. Expected behavior should be automatically changing sourceOnDemand from value true to false, when we send { "record": true } request body. Another option is returning exception from API with message saying something like "you cannot start recording on camera with source on demand".

Describe how to replicate the issue

  1. Start the server.
  2. Add path with properties source, sourceOnDemand (true) and sourceOnDemandCloseAfter (through API).
  3. Send PATCH request with body { "record": true } through API.
  4. Check logs to see the segmentation error.

Did you attach the server logs?

yes

Below, after sending PATCH request.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xcf1d60]

goroutine 193 [running]:
github.com/bluenviron/mediamtx/internal/core.(*staticSourceHandler).reloadConf(0x75ce25?, 0xc00051e540?)
        /s/internal/core/static_source_handler.go:229 +0x20
created by github.com/bluenviron/mediamtx/internal/core.(*path).doReloadConf in goroutine 164
        /s/internal/core/path.go:374 +0x173

Did you attach a network dump?

no

aler9 commented 2 months ago

Thanks for reporting the crash, this is fixed by #3249.

In the meanwhile, you can use the nightly binaries available here:

https://github.com/bluenviron/mediamtx/actions/runs/8688254581

github-actions[bot] commented 2 months ago

This issue is mentioned in release v1.8.0 🚀 Check out the entire changelog by clicking here