crypto_com_client icon indicating copy to clipboard operation
crypto_com_client copied to clipboard

no close frame received or sent

Open Cacti2333 opened this issue 1 year ago • 2 comments

Hello, thanks for all the work that you've done.

I'm using your script on Linux and after some time of receiving order book, I get the exception "no close frame received or sent".

Not sure why this happens and I'm not able to stop the execution to re-run the script to start over.

  • I tested it on a VPS too
  • Used try catch to print the error (which works) and leave the loop (which doesn't work)
  • Freezes after printing the error "no close frame received or sent"
try:
        loop = asyncio.new_event_loop()
        loop.run_until_complete(ASYNC_FUNCTION_NAME)
    except KeyboardInterrupt:
        print("KeyboardInterrupt")
    except Exception as error:
        print(f"CLI Exception {error=}")
    finally:
        loop.close()

With regards

Cacti2333 avatar Sep 05 '24 12:09 Cacti2333

Hello, this error is caused by an abrupt connection close. The conection was closed by the remote but no "connection close" frame was received.

I can try to add a reconnection functionality but of course the program should at least exit with error and not keep running but doing nothing.

I will add a functionality to raise to the top level program this error (and if not handled, the aplication will end with error). Is this ok for you?

maxpowel avatar Sep 14 '24 17:09 maxpowel

Thank you so much @maxpowel

I will add a functionality to raise to the top level program this error (and if not handled, the aplication will end with error). Is this ok for you?

This would be amazing. I should also mention that the above code works and catches the exception but I would appreciate it if you could make necessary changes to raise the exception so that people simply can catch it. (I am not sure why I wasn't able to catch it in other types of Asyncio loops and run.

Thanks in advance

Cacti2333 avatar Sep 16 '24 05:09 Cacti2333