Application crashed (panic: close of closed channel)
Hello,
I am using go2rtc as solution to stream translations for a small event over WiFi. The signal is picked up over ffmpeg from an audio interface, configured over Alsa. The following error occurs from time to time (not yet known if consistently reproducable by any direct action):
panic: close of closed channel
goroutine 1797 [running]:
github.com/AlexxIT/go2rtc/pkg/core. (*Sender).Close(0x0?)
github.com/AlexxIT/go2rtc/pkg/core/track.go:174 +0x96
github.com/AlexxIT/go2rtc/pkg/core. (*Connection).Stop(0xc0005da420)
github.com/AlexxIT/go2rtc/pkg/core/connection.go:74 +0x90
github.com/AlexxIT/go2rtc/internal/streams. (*Stream). RemoveConsumer (0xc00015c840, {0xd91400, 0xc0005da420})
github.com/AlexxIT/go2rtc/internal/streams/stream.go:58 +0x30
github.com/AlexxIT/go2rtc/internal/webrtc.asyncHandler.func1({0xb6f6a0?,
github.com/AlexxIT/go2rtc/internal/webrtc/webrtc.go:131 +0x9b
github.com/AlexxIT/go2rtc/pkg/core.(*Listener).Fire(...)
github.com/AlexxIT/go2rtc/pkg/core/listener.go:16
github.com/AlexxIT/go2rtc/pkg/webrtc.NewConn.func5(0x6)
github.com/AlexxIT/go2rtc/pkg/webrtc/conn.go:128 +0x68
0x1221950?})
created by github.com/pion/webrtc/v3. (*PeerConnection).onConnectionStateChange in goroutine 1796
github.com/pion/webrtc/[email protected]/peerconnection.go:500 +0x16f
[1] + Exit 2
My configuration so far:
streams:
original: ffmpeg:device?audio=inchannel0&channels=1&sample_rate=16000&#audio=opus
polish: ffmpeg:device?audio=inchannel1&channels=1&sample_rate=16000&#audio=opus
russian: ffmpeg:device?audio=inchannel3&channels=1&sample_rate=16000&#audio=opus
czech: ffmpeg:device?audio=inchannel2&channels=1&sample_rate=16000&#audio=opus
api:
listen: ":1984"
ffmpeg:
bin: "ffmpeg"
aac: "-re -codec:a libmp3lame -fflags nobuffer"
log:
format: "color"
level: "info"
output: "stdout"
time: "UNIXMS"
rtsp:
listen: ":8554"
default_query: "video&audio"
srtp:
listen: ":8443"
webrtc:
listen: ":8555/tcp"
ice_servers:
- urls: [ "stun:stun.l.google.com:19302" ]
Thanks for your work, making this software publicly available. Hopefully this bug report helps to tackle that bug.
Greetings
What version are you using?
Hi Alex, I've been using version 1.9.4
having the same issue in Homae Assistant a few hours ago, only started occurring after update to 2024.9, same version of gotortc 1.9.4 same error
goroutine 31563 [running]:
github.com/AlexxIT/go2rtc/pkg/core.(*Sender).Close(0xc009519e04?)
github.com/AlexxIT/go2rtc/pkg/core/track.go:174 +0x96
github.com/AlexxIT/go2rtc/pkg/core.(*Connection).Stop(0xc00e5a6420)
github.com/AlexxIT/go2rtc/pkg/core/connection.go:74 +0x90
github.com/AlexxIT/go2rtc/internal/streams.(*Stream).RemoveConsumer(0xc0000de0c0, {0xd90aa0, 0xc00e5a6420})
github.com/AlexxIT/go2rtc/internal/streams/stream.go:58 +0x30
github.com/AlexxIT/go2rtc/internal/webrtc.asyncHandler.func1({0xb6f6a0?, 0x1221950?})
github.com/AlexxIT/go2rtc/internal/webrtc/webrtc.go:131 +0x9b
github.com/AlexxIT/go2rtc/pkg/core.(*Listener).Fire(...)
github.com/AlexxIT/go2rtc/pkg/core/listener.go:16
github.com/AlexxIT/go2rtc/pkg/webrtc.NewConn.func5(0x6)
github.com/AlexxIT/go2rtc/pkg/webrtc/conn.go:128 +0x68
created by github.com/pion/webrtc/v3.(*PeerConnection).onConnectionStateChange in goroutine 31562
github.com/pion/webrtc/[email protected]/peerconnection.go:500 +0x16f
08:15:43.664 INF go2rtc platform=linux/amd64 revision=a4885c2 version=1.9.4
08:15:43.664 INF config path=/config/go2rtc.yaml
08:15:43.664 INF [rtsp] listen addr=:8554
08:15:43.664 INF [api] listen addr=:1984
08:15:43.664 INF [webrtc] listen addr=:8555/tcp
panic: close of closed channel
Hello Alex,
Good morning. We are also facing the same issue, which is similar with the issue #1287 which was posted by me. Please recommend us which version you want us to resolve this issue, if there is the resolution? Thank you.
Best Regards, Chandramouli.
I am also seeing this error from time to time. Any solution, yet?
I have this crash intermittently as well. I was going to post the log, but it looks like it's the same as the original issue report.
Turning on the "watchdog" setting will probably fix this since it will restart the addon if it crashes.
Hello Alex,
Good morning and thank you for your great work. We are still facing the crash issue. One more important observation is, the content from the go2rtc.yaml file is erasing and becomes blank. It would be great help if you release any fix for this. Thank you.
Best Regards, Chandramouli.
I'm also facing these crashes on version 1.9.7
Hello
I'm having the same issue on 1.9.8.
https://github.com/AlexxIT/go2rtc/releases/tag/v1.9.9
in func (d *DialWrap) dialParallel(ctx context.Context, primaries, fallbacks []net.IP, network string, port string) start 2 routines go startRacer(primaryCtx, true) go startRacer(fallbackCtx, false)
when dialParallel return , and call defer function " close(returned)" , the routine startRacer would write a close channel. this will triger panic. But the logs should output "panic: close of closed channel", but it did not. That's odd.