`firebase_admin.db.reference` leaks connections in a `CLOSE_WAIT` state
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
調査の方向性
まず、Python websocket サーバーで問題を再現します。firebase_admin.db.reference を作成し、接続ハンドラーで set を呼び出してください。接続が終了した後に netstat を使用して CLOSE_WAIT ソケットを調べます。参照接続のライフサイクルが説明され、報告された蓄積が解消されるか、必要な teardown の動作が文書化されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Step 2: Describe your environment
- Operating System version: OS X Ventura 13.4
- Firebase SDK version: 6.2.0
- Firebase Product: database
- Python version: 3.11.2
- Pip version: 23.1.2
Step 3: Describe the problem
I have a Python websocket application that creates a reference to RTDB via firebase_admin.db.reference, and writes to it via the set method. I create one reference per connection to my database. It appears that this reference does not necessarily get cleaned up, as I've noticed in my server that connections with a CLOSE_WAIT state are aggregating specifically with this RTDB update. More concerning is that the application appears to be receiving bytes of data at a consistent rate from this connection despite it being in a CLOSE_WAIT state.
What is the proper way to tear down a reference once I know I'm done with it? It seems like this is a bug from the firebase_admin python package as there don't be any instructions or indication that we need to tear down the reference.
Steps to reproduce:
- Create a Python websocket server with the
websocketslibrary - Within the connection handler, instantiate a reference via
firebase_admin.db.referenceand write a value - Approximately 1 minute after the connection terminates, use
netstatto observe that the connection still exists in aCLOSE_WAITstate and that the application is receiving data from it.
Here's my netstat output
root@474683837e04:/app# netstat -ntuap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.11:38913 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1/python
tcp 25 0 172.24.0.3:34160 34.120.160.131:443 CLOSE_WAIT 1/python
tcp 1 0 172.24.0.3:58576 142.250.191.74:443 CLOSE_WAIT 1/python
tcp6 0 0 :::8080 :::* LISTEN 1/python
udp 0 0 127.0.0.11:54888 0.0.0.0:* -
Using connections with all of the reference related code commented out and then netstat'ing after shows that this issue does not appeare.
- 主要言語
- Python
- スター
- 1.2k
- フォーク
- 359
- 平均マージ
- 5日 6分
- マージ済み PR(30日)
- 2
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
firebase/firebase-admin-python のほかの issue
-
api: remoteconfig
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
firebase/firebase-admin-python#957 · コメント 1 件 ·
-
api: database type: feature request
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
firebase/firebase-admin-python#978 · コメント 1 件 ·
-
[FR] Support VERIFY_AND_CHANGE_EMAIL in generate_email_action_link (parity with firebase-admin-node) オープンapi: auth
firebase/firebase-admin-python#949 · コメント 2 件 · リアクション 1 件 · 担当者 1 名 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 43/100
firebase/firebase-admin-python#945 · コメント 1 件 · リアクション 1 件 ·
firebase/firebase-admin-python の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
learningequality/ricecooker#747 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
run-llama/llama_index#23199 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
KhronosGroup/glTF-Blender-IO#2769 ·