Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.8.0 crash by panic: runtime error: slice bounds out of range [2:1] #3754

Closed
1 of 13 tasks
Titianzi opened this issue Sep 10, 2024 · 1 comment · Fixed by bluenviron/gortsplib#617
Closed
1 of 13 tasks
Labels
bug Something isn't working rtsp

Comments

@Titianzi
Copy link

Which version are you using?

v1.8.0

Which operating system are you using?

  • Linux amd64 standard
  • Linux amd64 Docker
  • Linux arm64 standard
  • Linux arm64 Docker
  • Linux arm7 standard
  • Linux arm7 Docker
  • Linux arm6 standard
  • Linux arm6 Docker
  • Windows amd64 standard
  • Windows amd64 Docker (WSL backend)
  • macOS amd64 standard
  • macOS amd64 Docker
  • Other (please describe)

Describe the issue

Description

Describe how to replicate the issue

I'm using mediamtx on my program for forward RTSP streams. In my using case, the Input video streams are very unstable so FFMPEG process always needs be stoped and restart again frequently. Mediamtx well worked for 7 hours then it crashed.
I'm sorry the bug is too random to replicate it, so I haven't found more info except server logs traceback.

  1. start the server (I use default configuration):
    ./mediamtx

  2. publish with ...

ffmpeg -rtsp_transport tcp -buffer_size 10240000 -stimeout 10000000 -i rtsp://10.110.74.77:1815/ {Camera ID} /livestream -c:v copy -f rtsp rtsp://127.0.0.1:8554/stream/{Camera ID}

  1. read with ...
    A gstreamer-1.0 C++ program with uri_decode_bin() and UDP protocol.

Did you attach the server logs?

Here are some error logs:

2024/09/09 17:55:28 INF [RTSP] [conn 127.0.0.1:45634] opened
2024/09/09 17:55:28 INF [RTSP] [session b39d5739] created by 127.0.0.1:45634
2024/09/09 17:55:29 INF [RTSP] [session eafb44e9] is reading from path 'stream/64069111101322020025', with UDP, 1 track (H265)
2024/09/09 17:55:29 INF [RTSP] [session b39d5739] is reading from path 'stream/46040095001321000124', with UDP, 1 track (H264)
2024/09/09 17:55:57 INF [RTSP] [conn 127.0.0.1:45680] opened
2024/09/09 17:55:57 INF [RTSP] [session 0c7b12b0] created by 127.0.0.1:45680
2024/09/09 17:55:57 INF [RTSP] [session 0c7b12b0] is publishing to path 'stream/46040095001321000164', 1 track (H264)
2024/09/09 17:55:58 INF [RTSP] [session 95434526] destroyed: torn down by 127.0.0.1:45620
2024/09/09 17:55:58 INF [RTSP] [conn 127.0.0.1:45634] closed: terminated
2024/09/09 17:55:58 INF [RTSP] [conn 127.0.0.1:45620] closed: EOF
2024/09/09 17:55:58 INF [RTSP] [session b39d5739] destroyed: terminated
2024/09/09 17:55:58 INF [RTSP] [conn 127.0.0.1:45682] opened
2024/09/09 17:56:07 INF [RTSP] [conn 127.0.0.1:45694] opened
2024/09/09 17:56:07 INF [RTSP] [session 76d8641d] created by 127.0.0.1:45694
2024/09/09 17:56:08 INF [RTSP] [session 76d8641d] is reading from path 'stream/46040095001321000164', with UDP, 1 track (H264)
2024/09/09 17:56:13 INF [RTSP] [session 76d8641d] destroyed: torn down by 127.0.0.1:45694
2024/09/09 17:56:13 INF [RTSP] [conn 127.0.0.1:45694] closed: EOF
2024/09/09 17:56:13 INF [RTSP] [conn 127.0.0.1:45712] opened
2024/09/09 17:56:13 INF [RTSP] [session 8a37a181] created by 127.0.0.1:45712
2024/09/09 17:56:14 INF [RTSP] [session 8a37a181] is reading from path 'stream/46040095001321000164', with TCP, 1 track (H264)
2024/09/09 17:56:14 INF [RTSP] [session 0c7b12b0] destroyed: torn down by 127.0.0.1:45680
2024/09/09 17:56:14 INF [RTSP] [conn 127.0.0.1:45680] closed: EOF
2024/09/09 17:56:14 INF [RTSP] [conn 127.0.0.1:45712] closed: terminated
2024/09/09 17:56:14 INF [RTSP] [session 8a37a181] destroyed: terminated
2024/09/09 17:56:26 INF [RTSP] [conn 127.0.0.1:45682] closed: EOF
panic: runtime error: slice bounds out of range [2:1]

goroutine 23 [running]:
github.com/bluenviron/gortsplib/v4/pkg/format.(*H265).PTSEqualsDTS(0xc00098c8d0?, 0xc0005ec360?)
/go/pkg/mod/github.com/bluenviron/gortsplib/[email protected]/pkg/format/h265.go:143 +0x186
github.com/bluenviron/gortsplib/v4.(*serverSessionFormat).readRTPUDP(0xc000412200, 0xc00047f1d0?, {0xc0005ec364?, 0x5c1?, 0x1787520?})
/go/pkg/mod/github.com/bluenviron/gortsplib/[email protected]/server_session_format.go:66 +0xbe
github.com/bluenviron/gortsplib/v4.(*serverSessionMedia).readRTPUDPRecord(0xc00001e200, {0xc0005f1200, 0x0?, 0x5c1})
/go/pkg/mod/github.com/bluenviron/gortsplib/[email protected]/server_session_media.go:214 +0x125
github.com/bluenviron/gortsplib/v4.(*serverUDPListener).run.func1(0xc000493600, 0xc0005f1200?, {0xc0005f1200, 0x5c1?, 0x5c1}, 0xd)
/go/pkg/mod/github.com/bluenviron/gortsplib/[email protected]/server_udp_listener.go:146 +0x174
github.com/bluenviron/gortsplib/v4.(*serverUDPListener).run(0xc000493600)
/go/pkg/mod/github.com/bluenviron/gortsplib/[email protected]/server_udp_listener.go:147 +0x6c
created by github.com/bluenviron/gortsplib/v4.(*serverUDPListener).initialize in goroutine 1
/go/pkg/mod/github.com/bluenviron/gortsplib/[email protected]/server_udp_listener.go:106 +0x20a

Did you attach a network dump?

no

@aler9
Copy link
Member

aler9 commented Sep 10, 2024

Thank you very much for reporting the crash, this is fixed by bluenviron/gortsplib#617

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rtsp
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants