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.69k stars 1.39k forks source link

Extra connections when attempting to read an SRT stream with incorrect credentials #3382

Open r-nov opened 1 month ago

r-nov commented 1 month ago

Which version are you using?

v1.8.2

Which operating system are you using?

Describe the issue

When I try to read an SRT stream with incorrect credentials (tested with ffmpeg, VLC, and GStreamer), mediamtx continues to receive authentication requests even after the first one fails. This blocks receiving any other requests for a significant amount of time. In the case of ffmpeg, it's 8 requests, which means you can't read the stream again for about 16 seconds. If during the processing of these requests there are additional requests with incorrect credentials, the wait time will increase further until mediamtx processes all these requests. So after a few attempts with incorrect credentials, mediamtx will be blocked for minutes, and you won't be able to read the stream even with the correct credentials. I guess this is an ffmpeg "feature" since VLC/GStreamer usually sends only 2-4 requests if you stop immediately after the first attempt, and mediamtx behaviour is correct, but it still prevents the normal use of mediamtx.

These are the logs when I try to read the stream with ffmpeg.

2024/05/24 10:16:09 INF MediaMTX v1.8.2
2024/05/24 10:16:09 INF configuration loaded from ***/mediamtx.yml
2024/05/24 10:16:09 DEB path manager created
2024/05/24 10:16:09 INF [SRT] listener opened on :8890 (UDP)
2024/05/24 10:16:27 INF [SRT] [conn 172.17.160.1:60176] opened
2024/05/24 10:16:29 INF [SRT] [conn 172.17.160.1:60176] closed: authentication failed: authentication failed
2024/05/24 10:16:29 INF [SRT] [conn 172.17.160.1:60176] opened
2024/05/24 10:16:31 INF [SRT] [conn 172.17.160.1:60176] closed: authentication failed: authentication failed
2024/05/24 10:16:31 INF [SRT] [conn 172.17.160.1:60176] opened
2024/05/24 10:16:33 INF [SRT] [conn 172.17.160.1:60176] closed: authentication failed: authentication failed
2024/05/24 10:16:33 INF [SRT] [conn 172.17.160.1:60176] opened
2024/05/24 10:16:35 INF [SRT] [conn 172.17.160.1:60176] closed: authentication failed: authentication failed
2024/05/24 10:16:35 INF [SRT] [conn 172.17.160.1:60176] opened
2024/05/24 10:16:37 INF [SRT] [conn 172.17.160.1:60176] closed: authentication failed: authentication failed
2024/05/24 10:16:37 INF [SRT] [conn 172.17.160.1:60176] opened
2024/05/24 10:16:39 INF [SRT] [conn 172.17.160.1:60176] closed: authentication failed: authentication failed
2024/05/24 10:16:39 INF [SRT] [conn 172.17.160.1:60176] opened
2024/05/24 10:16:41 INF [SRT] [conn 172.17.160.1:60176] closed: authentication failed: authentication failed
2024/05/24 10:16:41 INF [SRT] [conn 172.17.160.1:60176] opened
2024/05/24 10:16:43 INF [SRT] [conn 172.17.160.1:60176] closed: authentication failed: authentication failed

Describe how to replicate the issue

  1. Start the server with default config and user/pass added to authInternalUsers
  2. Read the SRT stream with ffmpeg (VLC/GStreamer) using incorrect credentials

Did you attach the server logs?

yes (see previous section)

Did you attach a network dump?

yes srt.zip