firebase-rest-api icon indicating copy to clipboard operation
firebase-rest-api copied to clipboard

[Bug]: closable stream not closing

Open dwatrous opened this issue 2 years ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Environment

-   OS: Windows/Linux
-   Python: 3

What happened?

Using the realtime database module with a stream, I frequently get an error when trying to close the connection

Code Snippet

This happens anytime close() is call
`my_stream.close()`

Relevant log output

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/firebase/database/_stream.py", line 63, in close
    self.sse.close()
  File "/usr/local/lib/python3.9/dist-packages/firebase/database/_closable_sse_client.py", line 29, in close
    self.resp.raw._fp.fp.raw._sock.shutdown(socket.SHUT_RDWR)
AttributeError: 'NoneType' object has no attribute 'raw'


### Anything else?

Right now I catch the exception and log it, then move on. Much of the time this works, but sometimes the entire app hangs while the thread is waiting on this and I have to kill the script and start it again.

dwatrous avatar Nov 09 '23 20:11 dwatrous