nats.py icon indicating copy to clipboard operation
nats.py copied to clipboard

Untreated error callbacks when using websockets

Open bvanelli opened this issue 1 year ago • 0 comments

Turns out some errors are not handled and show full traceback when using websockets. For example this one, when I restart the nats server:

ERROR:nats.aio.client:nats: encountered error
Traceback (most recent call last):
  File "C:\Users\brunno.vanelli\PycharmProjects\base-python\venv\lib\site-packages\nats\aio\[client.py](http://client.py/)", line 2035, in _read_loop
    await self._ps.parse(b)
  File "C:\Users\brunno.vanelli\PycharmProjects\base-python\venv\lib\site-packages\nats\protocol\[parser.py](http://parser.py/)", line 93, in parse
    self.buf.extend(data)
TypeError: can't extend bytearray with int

Or this one, that I could not reproduce but I guess is related to reconnect:

ERROR:nats.aio.client:nats: encountered error
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000022EB5AE54C0>
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000022EB34A3130>

If anyone finds more of those please append to the issue.

I'll submit a merge request once I do more testing and find more edge cases.

bvanelli avatar Oct 04 '22 15:10 bvanelli