Skip to content

InvalidStateError #110

Closed
Closed
@oliver-zehentleitner

Description

@oliver-zehentleitner

Related to issue #18, #105, #83

The first issue #18 was created in Jun 2019 by @DaWe35 who reported this error:

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/user/.local/lib/python3.6/site-packages/unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py", line 142, in _create_stream_thread
    loop.run_until_complete(binance_websocket_api_socket.start_socket())
  File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()
  File "/home/user/.local/lib/python3.6/site-packages/unicorn_binance_websocket_api/unicorn_binance_websocket_api_socket.py", line 62, in start_socket
    received_stream_data_json = await websocket.receive()
  File "/home/user/.local/lib/python3.6/site-packages/unicorn_binance_websocket_api/unicorn_binance_websocket_api_connection.py", line 183, in receive
    received_data = await self.handler_binance_websocket_api_manager.websocket_list[self.stream_id].recv()
  File "/home/user/.local/lib/python3.6/site-packages/websockets/protocol.py", line 441, in recv
    self._put_message_waiter.set_result(None)
asyncio.base_futures.InvalidStateError: invalid state

We added an error handling for asyncio.base_futures.InvalidStateError: invalid state and a restart process for the stream and it worked well for a while.

In Nov 2019 the websockets 8.1 was released and we switched over to it as a requirement, we are using newer python versions and it looks like, that something important has changed.

So I think its the best to remove that code part and lets see whats happens then..

If someone is receiving a new InvalidStateError please post

  1. websockets version
  2. python version
  3. OS
  4. stream_buffer or process_stream_data

in this issue below!

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions