Handle Timeout errors
Closed this issue · 0 comments
To reproduce, run ./ob_updater.py
with a settings.ini configured with a lot of pairs. Here the stacktrace.
ob bitfinex2 XRP/BTC, None: ask [9.038e-05, -500]; bid: [9.033e-05, 226.91324961]
ob bitfinex2 XRP/BTC, None: ask [9.038e-05, -500]; bid: [9.033e-05, 226.91324961]
ob bitfinex2 XRP/BTC, None: ask [9.038e-05, -500]; bid: [9.033e-05, 226.91324961]
Task exception was never retrieved
future: <Task finished coro=<subscribe_ws() done, defined at /home/firepol/projects-python/ccxtws/utils.py:48> exception=TimeoutError('timeout in scope: websocket_subscribe',)>
Traceback (most recent call last):
File "/home/firepol/projects-python/ccxtws/utils.py", line 84, in subscribe_ws
await exchange.websocket_subscribe(event, symbol, {'limit': limit})
File "/home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/base/exchange.py", line 805, in websocket_subscribe
await future
TimeoutError: timeout in scope: websocket_subscribe
Task exception was never retrieved
future: <Task finished coro=<subscribe_ws() done, defined at /home/firepol/projects-python/ccxtws/utils.py:48> exception=TimeoutError('timeout in scope: websocket_subscribe',)>
Traceback (most recent call last):
File "/home/firepol/projects-python/ccxtws/utils.py", line 84, in subscribe_ws
await exchange.websocket_subscribe(event, symbol, {'limit': limit})
File "/home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/base/exchange.py", line 805, in websocket_subscribe
await future
TimeoutError: timeout in scope: websocket_subscribe
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
/usr/lib/python3.6/asyncio/base_events.py:498: RuntimeWarning: coroutine 'MyClientProtocol.onMessage' was never awaited
self._ready.clear()
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Task was destroyed but it is pending!
task: <Task pending coro=<MyClientProtocol.onMessage() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/websocket/pusher_light_connection.py:61>>
Closing Loop
After complete
coinbasepro requires to release all resources with an explicit call to the .close() coroutine. If you are creating the exchange instance from within your async coroutine, add exchange.close() to your code into a place when you're done with the exchange and don't need the exchange instance anymore (at the end of your async coroutine).
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fbdb6522fd0>
Fatal write error on socket transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fbda6ea6b70>
transport: <_SelectorSocketTransport fd=15>
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/selector_events.py", line 763, in write
n = self._sock.send(data)
OSError: [Errno 9] Bad file descriptor
Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fbda6ea6b70>
transport: <_SelectorSocketTransport closing fd=15>
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/selector_events.py", line 763, in write
n = self._sock.send(data)
OSError: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/sslproto.py", line 650, in _process_write_backlog
self._transport.write(chunk)
File "/usr/lib/python3.6/asyncio/selector_events.py", line 767, in write
self._fatal_error(exc, 'Fatal write error on socket transport')
File "/usr/lib/python3.6/asyncio/selector_events.py", line 645, in _fatal_error
self._force_close(exc)
File "/usr/lib/python3.6/asyncio/selector_events.py", line 657, in _force_close
self._loop.call_soon(self._call_connection_lost, exc)
File "/usr/lib/python3.6/asyncio/base_events.py", line 580, in call_soon
self._check_closed()
File "/usr/lib/python3.6/asyncio/base_events.py", line 366, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Fatal write error on socket transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fbda6f0c208>
transport: <_SelectorSocketTransport fd=12>
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/selector_events.py", line 763, in write
n = self._sock.send(data)
OSError: [Errno 9] Bad file descriptor
Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fbda6f0c208>
transport: <_SelectorSocketTransport closing fd=12>
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/selector_events.py", line 763, in write
n = self._sock.send(data)
OSError: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/sslproto.py", line 650, in _process_write_backlog
self._transport.write(chunk)
File "/usr/lib/python3.6/asyncio/selector_events.py", line 767, in write
self._fatal_error(exc, 'Fatal write error on socket transport')
File "/usr/lib/python3.6/asyncio/selector_events.py", line 645, in _fatal_error
self._force_close(exc)
File "/usr/lib/python3.6/asyncio/selector_events.py", line 657, in _force_close
self._loop.call_soon(self._call_connection_lost, exc)
File "/usr/lib/python3.6/asyncio/base_events.py", line 580, in call_soon
self._check_closed()
File "/usr/lib/python3.6/asyncio/base_events.py", line 366, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Fatal write error on socket transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fbda77a6a20>
transport: <_SelectorSocketTransport fd=13>
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/selector_events.py", line 763, in write
n = self._sock.send(data)
OSError: [Errno 9] Bad file descriptor
Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fbda77a6a20>
transport: <_SelectorSocketTransport closing fd=13>
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/selector_events.py", line 763, in write
n = self._sock.send(data)
OSError: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/sslproto.py", line 650, in _process_write_backlog
self._transport.write(chunk)
File "/usr/lib/python3.6/asyncio/selector_events.py", line 767, in write
self._fatal_error(exc, 'Fatal write error on socket transport')
File "/usr/lib/python3.6/asyncio/selector_events.py", line 645, in _fatal_error
self._force_close(exc)
File "/usr/lib/python3.6/asyncio/selector_events.py", line 657, in _force_close
self._loop.call_soon(self._call_connection_lost, exc)
File "/usr/lib/python3.6/asyncio/base_events.py", line 580, in call_soon
self._check_closed()
File "/usr/lib/python3.6/asyncio/base_events.py", line 366, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
bitfinex2 requires to release all resources with an explicit call to the .close() coroutine. If you are creating the exchange instance from within your async coroutine, add exchange.close() to your code into a place when you're done with the exchange and don't need the exchange instance anymore (at the end of your async coroutine).
bitstamp requires to release all resources with an explicit call to the .close() coroutine. If you are creating the exchange instance from within your async coroutine, add exchange.close() to your code into a place when you're done with the exchange and don't need the exchange instance anymore (at the end of your async coroutine).
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fbdb6d93668>
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fbdb6510ac8>
Task was destroyed but it is pending!
task: <Task pending coro=<subscribe_ws() running at /home/firepol/projects-python/ccxtws/utils.py:84> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fbdb6e0b768>()]>>
Task was destroyed but it is pending!
task: <Task pending coro=<throttle..run() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/base/throttle.py:41> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fbda6f056a8>()]>>
Task was destroyed but it is pending!
task: <Task pending coro=<Exchange._executeAndCallback..t() running at /home/firepol/env/ccxtws/lib/python3.6/site-packages/ccxt/async_support/base/exchange.py:747> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fbda6f05678>()]>>
binance requires to release all resources with an explicit call to the .close() coroutine. If you are creating the exchange instance from within your async coroutine, add exchange.close() to your code into a place when you're done with the exchange and don't need the exchange instance anymore (at the end of your async coroutine).
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fbdb6d93a90>
Future exception was never retrieved
future:
TimeoutError