LUCIT-Systems-and-Development / unicorn-binance-websocket-api

A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a simple, fast, flexible, robust and fully-featured way.
https://unicorn-binance-websocket-api.docs.lucit.tech/
Other
678 stars 166 forks source link

asyncio.exceptions.TimeoutError #207

Closed reasondk closed 2 years ago

reasondk commented 2 years ago

Hi,If the network is suddenly interrupted, asyncio will occur a network timeout. After while the network connected again, the program still fails!

How to solve it?

—————————————————————————————————————————————————————————————— Exception in thread Thread-6: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/websockets/legacy/client.py", line 653, in await_impl transport, protocol = await self._create_connection() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 1041, in create_connection sock = await self._connect_sock( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 955, in _connect_sock await self.sock_connect(sock, address) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 502, in sock_connect return await fut asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/tasks.py", line 492, in wait_for fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 973, in _bootstrap_inner self.run() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 910, in run self._target(*self._args, **self._kwargs) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py", line 473, in _create_stream_thread loop.run_until_complete(socket.start_socket()) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/unicorn_binance_websocket_api/unicorn_binance_websocket_api_socket.py", line 63, in start_socket async with BinanceWebSocketApiConnection(self.manager, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/unicorn_binance_websocket_api/unicorn_binance_websocket_api_connection.py", line 144, in aenter self.manager.websocket_list[self.stream_id] = await self._conn.aenter() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/websockets/legacy/client.py", line 632, in aenter return await self File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/websockets/legacy/client.py", line 649, in await_impl_timeout return await asyncio.wait_for(self.await_impl(), self.open_timeout) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/tasks.py", line 494, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError

oliver-zehentleitner commented 2 years ago

Please provide answers to asked questions of a bug report! I need the information to find the reason!

oliver-zehentleitner commented 2 years ago

... as i already asked for in https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/issues/206

oliver-zehentleitner commented 2 years ago

Possibly a duplicate of https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/221