streamlit-webrtc
streamlit-webrtc copied to clipboard
Connection is shutdown and errors appear in some network environment
2021-12-07 12:15:52.399 ICE connection state is closed
2021-12-07 12:15:52.508 Exception in callback Transaction.__retry()
handle: <TimerHandle when=2430488.613205439 Transaction.__retry()>
Traceback (most recent call last):
File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 1056, in sendto
self._sock.sendto(data, addr)
AttributeError: 'NoneType' object has no attribute 'sendto'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/appuser/venv/lib/python3.9/site-packages/aioice/stun.py", line 309, in __retry
self.__protocol.send_stun(self.__request, self.__addr)
File "/home/appuser/venv/lib/python3.9/site-packages/aioice/ice.py", line 242, in send_stun
self.transport.sendto(bytes(message), addr)
File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 1066, in sendto
self._fatal_error(
File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 713, in _fatal_error
self._loop.call_exception_handler({
AttributeError: 'NoneType' object has no attribute 'call_exception_handler'
2021-12-07 12:16:08.102 Exception in callback Transaction.__retry()
handle: <TimerHandle when=2430504.30243599 Transaction.__retry()>
Traceback (most recent call last):
File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 1056, in sendto
self._sock.sendto(data, addr)
AttributeError: 'NoneType' object has no attribute 'sendto'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/appuser/venv/lib/python3.9/site-packages/aioice/stun.py", line 309, in __retry
self.__protocol.send_stun(self.__request, self.__addr)
File "/home/appuser/venv/lib/python3.9/site-packages/aioice/ice.py", line 242, in send_stun
self.transport.sendto(bytes(message), addr)
File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 1066, in sendto
self._fatal_error(
File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 713, in _fatal_error
self._loop.call_exception_handler({
AttributeError: 'NoneType' object has no attribute 'call_exception_handler'
A post in https://github.com/aiortc/aiortc/issues/85 says
Maybe the root cause is something weird happening in the python selector generated by others things that share the same event loop.
Hypothesis:
- The WebRTC connection is properly closed as ICE failed under this network environment ("ICE connection state is closed")
- So the event loop is closed or stopped in weird state.
As commented at https://github.com/whitphx/streamlit-webrtc/issues/552#issuecomment-987885401, I think this error message itself is a subsequent event following a network problem, so if it appears, people should check the network set-up. ~~https://github.com/whitphx/streamlit-webrtc#network-connectivity~~ https://github.com/whitphx/streamlit-webrtc#configure-the-stun-server and https://github.com/whitphx/streamlit-webrtc#configure-the-turn-server-if-necessary may help.
Besides, I will also try to get rid of this exact error message too.