Skip to content
New issue

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

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

Already on GitHub? # to your account

Fatal error: concurrent map read and map write #1612

Open
RobusX opened this issue Feb 19, 2025 · 0 comments
Open

Fatal error: concurrent map read and map write #1612

RobusX opened this issue Feb 19, 2025 · 0 comments
Assignees
Labels
bug Something isn't working panic

Comments

@RobusX
Copy link

RobusX commented Feb 19, 2025

I am using locally latest go2rtc "hardware version" addon with latest HA release 2025.2.4 with Web RTC integration on the HAOS Mini PC blackview MP80 as HA server to stream EZVIZ CTQ2C cam stream via rtps to my two Tablet devices (amazon Fire(pure h265 not displayed, needs ffmpeg conv, large delay 5-10s) & Lenovo(pure h265ok, 0-5s delay). But, In the logs below, both tablets received the same ffmpeg:rtsp url. I have all latest version installed. Suddenly a go2rtc "hardware version" addon crashed.
Logs are below.

Thank you very much for your great work !

21:54:22.102 DBG [exec] run rtsp launch=2.088946536s
21:54:22.102 DBG [webrtc] add consumer error="streams: codecs not matched: video:H265 => video:VP8, video:VP9, video:AV1, video:H264, audio:OPUS, audio:G722, audio:PCMU, audio:PCMA, audio:S16B, audio:S16L"
21:54:22.105 DBG [streams] start producer url=ffmpeg:rtsp://admin:IYMAPA@192.168.22.152:554/h264_stream/ch0#video=h265
21:54:22.105 DBG [webrtc] add consumer error="streams: codecs not matched: video:H265 => video:VP8, video:VP9, video:AV1, video:H264, audio:OPUS, audio:G722, audio:PCMU, audio:PCMA, audio:S16B, audio:S16L"
21:54:55.766 DBG [streams] stop producer url=ffmpeg:rtsp://admin:IYMAPA@192.168.22.152:554/h264_stream/ch0#video=h265
21:56:06.952 DBG [webrtc] new consumer src=ffmpeg:rtsp://admin:IYMAPA@192.168.22.152:554/h264_stream/ch0#video=h265
21:56:06.953 DBG [exec] run rtsp args=["ffmpeg","-hide_banner","-v","error","-allowed_media_types","video","-fflags","nobuffer","-flags","low_delay","-timeout","5000000","-user_agent","go2rtc/ffmpeg","-rtsp_flags","prefer_tcp","-i","rtsp://admin:IYMAPA@192.168.22.152:554/h264_stream/ch0","-c:v","libx265","-g","50","-profile:v","main","-level:v","5.1","-preset:v","superfast","-tune:v","zerolatency","-pix_fmt:v","yuv420p","-an","-user_agent","ffmpeg/go2rtc","-rtsp_transport","tcp","-f","rtsp","rtsp://127.0.0.1:8554/2a2bea1e8e34cc82791c8ccd40e09ad0"]
21:56:08.008 DBG [webrtc] new consumer src=ffmpeg:rtsp://admin:IYMAPA@192.168.22.152:554/h264_stream/ch0#video=h265
21:56:09.397 DBG [exec] [hevc @ 0x555944cea140] Could not find ref with POC 21
21:56:09.413 DBG [exec] x265 [info]: HEVC encoder version 3.6+1-aa7f602f7
x265 [info]: build info [Linux][GCC 14.2.0][64 bit] 8bit+10bit+12bit
21:56:09.413 DBG [exec] x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
21:56:09.413 DBG [exec] x265 [info]: Main profile, Level-4 (Main tier)
21:56:09.414 DBG [exec] x265 [info]: Thread pool created using 4 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 2 / wpp(34 rows)
21:56:09.418 DBG [exec] x265 [info]: Coding QT: max CU size, min CU size : 32 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 1 / 2
x265 [info]: Lookahead / bframes / badapt        : 0 / 0 / 0
x265 [info]: b-pyramid / weightp / weightb       : 0 / 0 / 0
x265 [info]: References / ref-limit  cu / depth  : 1 / off / off
x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
x265 [info]: tools: rd=2 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: fast-intra strong-intra-smoothing lslices=6 deblock
21:56:09.460 DBG [exec] run rtsp launch=2.506482388s
21:56:09.460 DBG [webrtc] add consumer error="streams: codecs not matched: video:H265 => video:VP8, video:VP9, video:AV1, video:H264, audio:OPUS, audio:G722, audio:PCMU, audio:PCMA, audio:S16B, audio:S16L"
21:56:09.460 DBG [streams] start producer url=ffmpeg:rtsp://admin:IYMAPA@192.168.22.152:554/h264_stream/ch0#video=h265
21:56:09.461 DBG [webrtc] add consumer error="streams: codecs not matched: video:H265 => video:VP8, video:VP9, video:AV1, video:H264, audio:OPUS, audio:G722, audio:PCMU, audio:PCMA, audio:S16B, audio:S16L"
21:56:42.733 DBG [streams] stop producer url=ffmpeg:rtsp://admin:IYMAPA@192.168.22.152:554/h264_stream/ch0#video=h265
fatal error: concurrent map read and map write

goroutine 153 [running]:
github.com/AlexxIT/go2rtc/internal/streams.GetOrPatch(0xc00023c000)
	github.com/AlexxIT/go2rtc/internal/streams/streams.go:127 +0x75
github.com/AlexxIT/go2rtc/internal/webrtc.asyncHandler(0xc00016c730, 0xc00028c060)
	github.com/AlexxIT/go2rtc/internal/webrtc/webrtc.go:98 +0xad
github.com/AlexxIT/go2rtc/internal/api/ws.apiWS.func2()
	github.com/AlexxIT/go2rtc/internal/api/ws/ws.go:134 +0x39
created by github.com/AlexxIT/go2rtc/internal/api/ws.apiWS in goroutine 151
	github.com/AlexxIT/go2rtc/internal/api/ws/ws.go:133 +0x366

goroutine 1 [chan receive, 3 minutes]:
github.com/AlexxIT/go2rtc/pkg/shell.RunUntilSignal()
	github.com/AlexxIT/go2rtc/pkg/shell/shell.go:77 +0x86
main.main()
	github.com/AlexxIT/go2rtc/main.go:96 +0x34e

goroutine 18 [IO wait]:
internal/poll.runtime_pollWait(0x7f468911f890, 0x72)
	runtime/netpoll.go:345 +0x85
internal/poll.(*pollDesc).wait(0x6?, 0x426ae5?, 0x0)
	internal/poll/fd_poll_runtime.go:84 +0x27
internal/poll.(*pollDesc).waitRead(...)
	internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Accept(0xc000036080)
	internal/poll/fd_unix.go:611 +0x2ac
net.(*netFD).accept(0xc000036080)
	net/fd_unix.go:172 +0x29
net.(*TCPListener).accept(0xc00004c040)
	net/tcpsock_posix.go:159 +0x1e
net.(*TCPListener).Accept(0xc00004c040)
	net/tcpsock.go:327 +0x30
net/http.(*Server).Serve(0xc0000ac000, {0xd9b978, 0xc00004c040})
	net/http/server.go:3260 +0x33e
github.com/AlexxIT/go2rtc/internal/api.listen({0xc709eb, 0x3}, {0xc71730, 0x5})
	github.com/AlexxIT/go2rtc/internal/api/api.go:103 +0x193
created by github.com/AlexxIT/go2rtc/internal/api.Init in goroutine 1
	github.com/AlexxIT/go2rtc/internal/api/api.go:72 +0x4a7

goroutine 19 [IO wait]:
internal/poll.runtime_pollWait(0x7f468911f798, 0x72)
	runtime/netpoll.go:345 +0x85
internal/poll.(*pollDesc).wait(0x7?, 0xc0003136c0?, 0x0)
	internal/poll/fd_poll_runtime.go:84 +0x27
internal/poll.(*pollDesc).waitRead(...)
	internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Accept(0xc000134d80)
	internal/poll/fd_unix.go:611 +0x2ac
net.(*netFD).accept(0xc000134d80)
	net/fd_unix.go:172 +0x29
net.(*TCPListener).accept(0xc000168cc0)
	net/tcpsock_posix.go:159 +0x1e
net.(*TCPListener).Accept(0xc000168cc0)
	net/tcpsock.go:327 +0x30
github.com/AlexxIT/go2rtc/internal/rtsp.Init.func1()
	github.com/AlexxIT/go2rtc/internal/rtsp/rtsp.go:64 +0x48
created by github.com/AlexxIT/go2rtc/internal/rtsp.Init in goroutine 1
	github.com/AlexxIT/go2rtc/internal/rtsp/rtsp.go:62 +0x475

goroutine 20 [IO wait, 3 minutes]:
internal/poll.runtime_pollWait(0x7f468911f6a0, 0x72)
	runtime/netpoll.go:345 +0x85
internal/poll.(*pollDesc).wait(0x8?, 0x0?, 0x0)
	internal/poll/fd_poll_runtime.go:84 +0x27
internal/poll.(*pollDesc).waitRead(...)
	internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Accept(0xc000135000)
	internal/poll/fd_unix.go:611 +0x2ac
net.(*netFD).accept(0xc000135000)
	net/fd_unix.go:172 +0x29
net.(*TCPListener).accept(0xc000168de0)
	net/tcpsock_posix.go:159 +0x1e
net.(*TCPListener).Accept(0xc000168de0)
	net/tcpsock.go:327 +0x30
github.com/pion/ice/v2.(*TCPMuxDefault).start(0xc00020aa80)
	github.com/pion/ice/v2@v2.3.36/tcp_mux.go:101 +0xe2
github.com/pion/ice/v2.NewTCPMuxDefault.func1()
	github.com/pion/ice/v2@v2.3.36/tcp_mux.go:92 +0x4f
created by github.com/pion/ice/v2.NewTCPMuxDefault in goroutine 1
	github.com/pion/ice/v2@v2.3.36/tcp_mux.go:90 +0x1db

goroutine 33 [syscall, 3 minutes]:
os/signal.signal_recv()
	runtime/sigqueue.go:152 +0x29
os/signal.loop()
	os/signal/signal_unix.go:23 +0x13
created by os/signal.Notify.func1.1 in goroutine 1
	os/signal/signal.go:151 +0x1f

goroutine 5 [IO wait]:
internal/poll.runtime_pollWait(0x7f468911f5a8, 0x72)
	runtime/netpoll.go:345 +0x85
internal/poll.(*pollDesc).wait(0xc000036100?, 0xc00033c000?, 0x0)
	internal/poll/fd_poll_runtime.go:84 +0x27
internal/poll.(*pollDesc).waitRead(...)
	internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc000036100, {0xc00033c000, 0x1000, 0x1000})
	internal/poll/fd_unix.go:164 +0x27a
net.(*netFD).Read(0xc000036100, {0xc00033c000?, 0xc00034fa98?, 0x514905?})
	net/fd_posix.go:55 +0x25
net.(*conn).Read(0xc000064030, {0xc00033c000?, 0x0?, 0xc000332038?})
	net/net.go:185 +0x45
net/http.(*connReader).Read(0xc000332030, {0xc00033c000, 0x1000, 0x1000})
	net/http/server.go:789 +0x14b
bufio.(*Reader).fill(0xc000324060)
	bufio/bufio.go:110 +0x103
bufio.(*Reader).Peek(0xc000324060, 0x4)
	bufio/bufio.go:148 +0x53
net/http.(*conn).serve(0xc0000b0000, {0xd9d350, 0xc0000342d0})
	net/http/server.go:2079 +0x749
created by net/http.(*Server).Serve in goroutine 18
	net/http/server.go:3290 +0x4b4

goroutine 176 [chan receive]:
os/exec.(*Cmd).awaitGoroutines(0xc0001a6300, 0x0)
	os/exec/exec.go:957 +0x1fa
os/exec.(*Cmd).Wait(0xc0001a6300)
	os/exec/exec.go:924 +0x16c
github.com/AlexxIT/go2rtc/internal/exec.handleRTSP.func2()
	github.com/AlexxIT/go2rtc/internal/exec/exec.go:157 +0x25
created by github.com/AlexxIT/go2rtc/internal/exec.handleRTSP in goroutine 168
	github.com/AlexxIT/go2rtc/internal/exec/exec.go:156 +0x37e

goroutine 151 [IO wait]:
internal/poll.runtime_pollWait(0x7f468911f2c0, 0x72)
	runtime/netpoll.go:345 +0x85
internal/poll.(*pollDesc).wait(0xc000036180?, 0xc00029c000?, 0x0)
	internal/poll/fd_poll_runtime.go:84 +0x27
internal/poll.(*pollDesc).waitRead(...)
	internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc000036180, {0xc00029c000, 0x1000, 0x1000})
	internal/poll/fd_unix.go:164 +0x27a
net.(*netFD).Read(0xc000036180, {0xc00029c000?, 0x0?, 0x0?})
	net/fd_posix.go:55 +0x25
net.(*conn).Read(0xc00033e000, {0xc00029c000?, 0xc000340000?, 0x2?})
	net/net.go:185 +0x45
bufio.(*Reader).fill(0xc000324a20)
	bufio/bufio.go:110 +0x103
bufio.(*Reader).Peek(0xc000324a20, 0x2)
	bufio/bufio.go:148 +0x53
github.com/gorilla/websocket.(*Conn).read(0xc000298160, 0x10?)
	github.com/gorilla/websocket@v1.5.3/conn.go:371 +0x26
github.com/gorilla/websocket.(*Conn).advanceFrame(0xc000298160)
	github.com/gorilla/websocket@v1.5.3/conn.go:809 +0x6d
github.com/gorilla/websocket.(*Conn).NextReader(0xc000298160)
	github.com/gorilla/websocket@v1.5.3/conn.go:1009 +0xb0
github.com/gorilla/websocket.(*Conn).ReadJSON(0xb8c900?, {0xb9a200, 0xc00028c0a0})
	github.com/gorilla/websocket@v1.5.3/json.go:50 +0x25
github.com/AlexxIT/go2rtc/internal/api/ws.apiWS({0xd9bc48, 0xc0002920e0}, 0xc0000a8240)
	github.com/AlexxIT/go2rtc/internal/api/ws/ws.go:122 +0x23e
net/http.HandlerFunc.ServeHTTP(0x1278890?, {0xd9bc48?, 0xc0002920e0?}, 0x70857a?)
	net/http/server.go:2171 +0x29
net/http.(*ServeMux).ServeHTTP(0x46a739?, {0xd9bc48, 0xc0002920e0}, 0xc0000a8240)
	net/http/server.go:2688 +0x1ad
net/http.serverHandler.ServeHTTP({0xc0002803c0?}, {0xd9bc48?, 0xc0002920e0?}, 0x6?)
	net/http/server.go:3142 +0x8e
net/http.(*conn).serve(0xc0007f7830, {0xd9d350, 0xc0000342d0})
	net/http/server.go:2044 +0x5e8
created by net/http.(*Server).Serve in goroutine 18
	net/http/server.go:3290 +0x4b4

goroutine 210 [IO wait]:
internal/poll.runtime_pollWait(0x7f468911f0d0, 0x72)
	runtime/netpoll.go:345 +0x85
internal/poll.(*pollDesc).wait(0xc00036e000?, 0xc000296000?, 0x0)
	internal/poll/fd_poll_runtime.go:84 +0x27
internal/poll.(*pollDesc).waitRead(...)
	internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc00036e000, {0xc000296000, 0x1000, 0x1000})
	internal/poll/fd_unix.go:164 +0x27a
net.(*netFD).Read(0xc00036e000, {0xc000296000?, 0xc00032a7c8?, 0xc00032a828?})
	net/fd_posix.go:55 +0x25
net.(*conn).Read(0xc00001e020, {0xc000296000?, 0x3139452d35414641?, 0xc00032a858?})
	net/net.go:185 +0x45
bufio.(*Reader).fill(0xc000324960)
	bufio/bufio.go:110 +0x103
bufio.(*Reader).Peek(0xc000324960, 0x2)
	bufio/bufio.go:148 +0x53
github.com/gorilla/websocket.(*Conn).read(0xc000298000, 0x10?)
	github.com/gorilla/websocket@v1.5.3/conn.go:371 +0x26
github.com/gorilla/websocket.(*Conn).advanceFrame(0xc000298000)
	github.com/gorilla/websocket@v1.5.3/conn.go:809 +0x6d
github.com/gorilla/websocket.(*Conn).NextReader(0xc000298000)
	github.com/gorilla/websocket@v1.5.3/conn.go:1009 +0xb0
github.com/gorilla/websocket.(*Conn).ReadJSON(0xc00016c5f0?, {0xb9a200, 0xc00028c000})
	github.com/gorilla/websocket@v1.5.3/json.go:50 +0x25
github.com/AlexxIT/go2rtc/internal/api/ws.apiWS({0xd9bc48, 0xc000292000}, 0xc0000a8120)
	github.com/AlexxIT/go2rtc/internal/api/ws/ws.go:122 +0x23e
net/http.HandlerFunc.ServeHTTP(0x1278890?, {0xd9bc48?, 0xc000292000?}, 0x70857a?)
	net/http/server.go:2171 +0x29
net/http.(*ServeMux).ServeHTTP(0x46a739?, {0xd9bc48, 0xc000292000}, 0xc0000a8120)
	net/http/server.go:2688 +0x1ad
net/http.serverHandler.ServeHTTP({0xc000280060?}, {0xd9bc48?, 0xc000292000?}, 0x6?)
	net/http/server.go:3142 +0x8e
net/http.(*conn).serve(0xc0001dfb90, {0xd9d350, 0xc0000342d0})
	net/http/server.go:2044 +0x5e8
created by net/http.(*Server).Serve in goroutine 18
	net/http/server.go:3290 +0x4b4

goroutine 154 [runnable]:
github.com/AlexxIT/go2rtc/internal/streams.ParseQuery({0xc0001902f5, 0xa})
	github.com/AlexxIT/go2rtc/internal/streams/helpers.go:19 +0x145
github.com/AlexxIT/go2rtc/internal/rtsp.rtspHandler({0xc0001902c0?, 0xc0001ce300?})
	github.com/AlexxIT/go2rtc/internal/rtsp/rtsp.go:102 +0x105
github.com/AlexxIT/go2rtc/internal/streams.GetProducer({0xc0001902c0, 0x3f})
	github.com/AlexxIT/go2rtc/internal/streams/handlers.go:49 +0xcb
github.com/AlexxIT/go2rtc/internal/streams.(*Producer).Dial(0xc0007f7a70)
	github.com/AlexxIT/go2rtc/internal/streams/producer.go:62 +0x95
github.com/AlexxIT/go2rtc/internal/streams.(*Stream).AddConsumer(0xc00020a380, {0xd9b618, 0xc0000a8360})
	github.com/AlexxIT/go2rtc/internal/streams/add_consumer.go:36 +0x68d
github.com/AlexxIT/go2rtc/internal/mp4.handlerWSMSE(0xc00016c730, 0xc00028c080)
	github.com/AlexxIT/go2rtc/internal/mp4/ws.go:29 +0x145
github.com/AlexxIT/go2rtc/internal/api/ws.apiWS.func2()
	github.com/AlexxIT/go2rtc/internal/api/ws/ws.go:134 +0x39
created by github.com/AlexxIT/go2rtc/internal/api/ws.apiWS in goroutine 151
	github.com/AlexxIT/go2rtc/internal/api/ws/ws.go:133 +0x366
21:58:11.377 INF go2rtc platform=linux/amd64 revision=8ecaabf version=1.9.7
21:58:11.377 DBG build vcs.time=2024-12-16T17:25:01Z version=go1.22.10
21:58:11.377 INF config path=/config/go2rtc.yaml
21:58:11.378 INF [api] listen addr=:1984
21:58:11.379 INF [rtsp] listen addr=:8554
21:58:11.379 INF [webrtc] listen addr=:8555/tcp
@AlexxIT AlexxIT added bug Something isn't working panic labels Feb 20, 2025
@AlexxIT AlexxIT self-assigned this Feb 20, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working panic
Projects
None yet
Development

No branches or pull requests

2 participants