error: use of closed network connection
I changed one of my cameras to a new Imou Bullet 2C 2MP camera, and since then the feed stops working a few times a day. I can access the camera at that time using for example VLC. I need to restart go2rtc in order to get it to work again. Errors I see in the go2rtc logs at that time:
2023-08-16 10:16:11.571773758 [INFO] Preparing go2rtc config...
2023-08-16 10:16:11.768661279 [INFO] Not injecting WebRTC candidates into go2rtc config as it has been set manually
2023-08-16 10:16:11.785698585 [WARN] Using go2rtc binary from '/config/go2rtc' instead of the embedded one
2023-08-16 10:16:11.785701862 [INFO] Starting go2rtc...
2023-08-16 10:16:11.904427802 10:16:11.904 INF go2rtc version 1.6.2 linux/amd64
2023-08-16 10:16:11.904778699 10:16:11.904 INF [api] listen addr=0.0.0.0:1984
2023-08-16 10:16:11.905096347 10:16:11.905 INF [rtsp] listen addr=0.0.0.0:8554
2023-08-16 10:16:11.905256590 10:16:11.905 INF [webrtc] listen addr=0.0.0.0:8555/tcp
2023-08-16 10:16:11.905784758 10:16:11.905 INF [srtp] listen addr=0.0.0.0:8443
2023-08-16 10:16:21.577284118 [INFO] Starting go2rtc healthcheck service...
2023-08-16 11:18:58.234245871 11:18:58.233 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:34284->10.1.0.110:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 11:47:54.795528419 11:47:54.795 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:53000->10.1.0.108:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 11:48:06.228433068 11:48:06.228 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:49084->10.1.0.104:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 12:44:20.391132954 12:44:20.390 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:41070->10.1.0.110:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 12:44:27.887068125 12:44:27.886 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:36666->10.1.0.110:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 12:44:39.447666825 12:44:39.447 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:39012->10.1.0.110:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 12:45:25.486236327 12:45:25.486 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:42788->10.1.0.110:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 12:46:04.661810557 12:46:04.661 INF [streams] can't get track error="dial tcp 10.1.0.110:554: i/o timeout"
2023-08-16 12:46:04.665044345 12:46:04.664 INF [streams] can't get track error="set tcp 172.21.0.2:48598: use of closed network connection"
2023-08-16 12:46:04.677304635 12:46:04.677 INF [streams] can't get track error="set tcp 172.21.0.2:48598: use of closed network connection"
2023-08-16 12:46:08.540732678 12:46:08.540 INF [streams] can't get track error="set tcp 172.21.0.2:48598: use of closed network connection"
2023-08-16 12:46:09.789536448 12:46:09.789 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="set tcp 172.21.0.2:48598: use of closed network connection" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 12:46:20.036259315 12:46:20.036 WRN [rtsp] error="exec: exit status 1" stream=fietsenhok
2023-08-16 12:46:20.942909617 12:46:20.942 INF [streams] can't get track error="set tcp 172.21.0.2:48598: use of closed network connection"
2023-08-16 12:46:20.942922277 12:46:20.942 INF [streams] can't get track error="set tcp 172.21.0.2:48598: use of closed network connection"
2023-08-16 12:46:20.942929043 12:46:20.942 INF [streams] can't get track error="set tcp 172.21.0.2:48598: use of closed network connection"
2023-08-16 12:46:20.943449473 12:46:20.942 INF [streams] can't get track error="set tcp 172.21.0.2:48598: use of closed network connection"
2023-08-16 12:46:28.709755627 12:46:28.709 WRN [streams] json locked
2023-08-16 12:46:30.286562901 12:46:30.286 WRN [rtsp] error="exec: exit status 1" stream=fietsenhok
2023-08-16 12:46:30.909484199 12:46:30.909 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:45508->10.1.0.110:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 12:46:35.412424913 12:46:35.412 WRN [rtsp] error="exec: exit status 1" stream=fietsenhok
2023-08-16 12:46:36.560655720 12:46:36.560 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:34930->10.1.0.110:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 12:46:40.531227237 12:46:40.530 WRN [rtsp] error="exec: exit status 1" stream=fietsenhok
2023-08-16 12:47:26.052896852 12:47:26.052 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:50520->10.1.0.110:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 12:47:28.724625717 12:47:28.724 WRN [streams] json locked
2023-08-16 12:47:55.683451736 12:47:55.683 INF [streams] can't get track error="dial tcp 10.1.0.110:554: i/o timeout"
2023-08-16 12:47:55.683649556 12:47:55.683 INF [streams] can't get track error="set tcp 172.21.0.2:37704: use of closed network connection"
2023-08-16 12:47:55.702698242 12:47:55.702 INF [streams] can't get track error="set tcp 172.21.0.2:37704: use of closed network connection"
2023-08-16 12:47:58.668200742 12:47:58.668 INF [streams] can't get track error="set tcp 172.21.0.2:37704: use of closed network connection"
2023-08-16 12:48:00.815856899 12:48:00.815 INF [streams] can't get track error="set tcp 172.21.0.2:37704: use of closed network connection"
2023-08-16 12:48:00.828298931 12:48:00.828 INF [streams] can't get track error="set tcp 172.21.0.2:37704: use of closed network connection"
2023-08-16 12:48:05.939140766 12:48:05.938 INF [streams] can't get track error="set tcp 172.21.0.2:37704: use of closed network connection"
I'm running on x86_64 Ubuntu 20.04.6 LTS, Frigate integrated.
go2rtc version is 1.6.2
Frigate version is 0.12.1-367D724
Any suggestions would be greatly appreciated!!
Looks like network connection problems. Many different IPs, drops connection...
The ‘use of closed network connection’ is for one IP only (the mentioned camera). And there may be a temporary connection drop out, yes, but the issue is that go2rtc never recovers. The camera’s rtsp stream is accessible by other means without problems (eg. VLC), when go2rtc is still spawning these errors…
Maybe VLC just doesn't spamming them :)
I can see three different IPs at different times.
2023-08-16 11:18:58.234245871 11:18:58.233 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:34284->10.1.0.110:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 11:47:54.795528419 11:47:54.795 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:53000->10.1.0.108:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 11:48:06.228433068 11:48:06.228 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:49084->10.1.0.104:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 12:44:20.391132954 12:44:20.390 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:41070->10.1.0.110:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 12:44:27.887068125 12:44:27.886 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:36666->10.1.0.110:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 12:44:39.447666825 12:44:39.447 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:39012->10.1.0.110:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 12:45:25.486236327 12:45:25.486 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.21.0.2:42788->10.1.0.110:554: i/o timeout" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
Anyway. Go2rtc shouldn't freezing. Can be hard to find exact place of problem in code.
Yeah so those "i/o timeout" messages do not seem to be causing the issue. The relevant log messages that indicate the non-recoverable situation are these:
2023-08-16 12:46:04.665044345 12:46:04.664 INF [streams] can't get track error="set tcp 172.21.0.2:48598: use of closed network connection"
2023-08-16 12:46:04.677304635 12:46:04.677 INF [streams] can't get track error="set tcp 172.21.0.2:48598: use of closed network connection"
2023-08-16 12:46:08.540732678 12:46:08.540 INF [streams] can't get track error="set tcp 172.21.0.2:48598: use of closed network connection"
2023-08-16 12:46:09.789536448 12:46:09.789 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="set tcp 172.21.0.2:48598: use of closed network connection" url=rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0
2023-08-16 12:46:20.942909617 12:46:20.942 INF [streams] can't get track error="set tcp 172.21.0.2:48598: use of closed network connection"
2023-08-16 12:46:20.942922277 12:46:20.942 INF [streams] can't get track error="set tcp 172.21.0.2:48598: use of closed network connection"
2023-08-16 12:46:20.942929043 12:46:20.942 INF [streams] can't get track error="set tcp 172.21.0.2:48598: use of closed network connection"
2023-08-16 12:46:20.943449473 12:46:20.942 INF [streams] can't get track error="set tcp 172.21.0.2:48598: use of closed network connection"
2023-08-16 12:47:55.683649556 12:47:55.683 INF [streams] can't get track error="set tcp 172.21.0.2:37704: use of closed network connection"
2023-08-16 12:47:55.702698242 12:47:55.702 INF [streams] can't get track error="set tcp 172.21.0.2:37704: use of closed network connection"
2023-08-16 12:47:58.668200742 12:47:58.668 INF [streams] can't get track error="set tcp 172.21.0.2:37704: use of closed network connection"
2023-08-16 12:48:00.815856899 12:48:00.815 INF [streams] can't get track error="set tcp 172.21.0.2:37704: use of closed network connection"
2023-08-16 12:48:00.828298931 12:48:00.828 INF [streams] can't get track error="set tcp 172.21.0.2:37704: use of closed network connection"
2023-08-16 12:48:05.939140766 12:48:05.938 INF [streams] can't get track error="set tcp 172.21.0.2:37704: use of closed network connection"
I thinks 172.21.0.2 is IP of Frigate. It drops connection for some reason
This might be a frigate bug I get something similar when one of my crappy Tapo C100 cameras has been flaky it can get stuck with no image, when I check the logs I see go2rtc spamming the can't get track error. Restarting frigate fixes the issue.
192.168.102.30 is the frigate/go2rtc host IP
github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="RTSP wrong input" url=rtsp://tapo_admin:[email protected]/stream1 can't get track error="set tcp 192.168.102.30:39958: use of closed network connection"
I'm seeing the same issue reported here using Frigate and go2rtc 1.9.2
I have a flaky wifi camera, Tapo C120, and eventually Frigate/go2rtc will fail to connect and never recover with the same errors posted above until I restart the Frigate docker container.
Other connections to the camera will recover, such as Scrypted, without the need to intervene