AsifArmanRahman / firebase-rest-api

A simple python wrapper for Google's Firebase REST API's.

Home Page:https://firebase-rest-api.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: closable stream not closing

dwatrous opened this issue · comments

Is there an existing issue for this?

  • 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.